
package com.rt.schedulenew.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rt.schedulebase.dto.ConfigDto;
import com.rt.schedulebase.dto.DictSysparamsDto;
import com.rt.schedulebase.dto.RuleDto;
import com.rt.schedulebase.entity.DictExamItem;
import com.rt.schedulebase.entity.DictExamQueue;
import com.rt.schedulebase.entity.DictSysparams;
import com.rt.schedulebase.mapper.DictSysparamsMapper;
import com.rt.schedulenew.api.IDictSysparamsService;
import com.rt.schedulenew.utils.base.CommonUtil;
import com.rt.schedulenew.utils.base.ConstantsUtil;
import com.rt.schedulenew.utils.global.BusinessException;
import com.rt.schedulenew.utils.global.JsonResult;
import com.rt.schedulenew.utils.global.JsonResultUtil;
import com.rt.schedulenew.utils.pkgenerator.PKGeneratorSingle;
import com.rt.schedulenew.utils.util.ColumnUtil;
import com.rt.schedulenew.utils.util.DateUtil;
import com.rt.schedulenew.utils.util.EhCacheUtil;
import com.rt.schedulenew.utils.util.JsonUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class DictSysparamsServiceImpl extends ServiceImpl<DictSysparamsMapper, DictSysparams> implements IDictSysparamsService {
    @Autowired
    private CacheServiceImpl cacheServiceImpl;
    @Autowired
    private ConfigServiceImpl configService;

    @Override
    public JsonResult getConfigInfo(DictSysparamsDto dto) {
        String configType = dto.getConfigType();
        ConfigDto configDto = new ConfigDto();

        // 后续可能会有其他配置替换掉里面的内容
        String paramValue = configService.getConfigByName(ConstantsUtil.ConfigName.CUSTOM_CONFIG.getKey());
        if (StringUtils.isNotBlank(paramValue)) {
            Map<String, Object> map = JsonUtil.json2Map(paramValue);
            configDto.setCustomConfig(map);
        }

        if (ConstantsUtil.ConfigType.INFO_SYNC.getKey().equals(configType)) {
            configDto = getConfigInfo4InfoSync();
        } else if (ConstantsUtil.ConfigType.SCHEDULE.getKey().equals(configType)) {
            getConfigInfo4Schedule(configDto);
        } else if (ConstantsUtil.ConfigType.SIGN.getKey().equals(configType)) {
            configDto = getConfigInfo4Sign();
        }
        // 其他配置
        else if (ConstantsUtil.ConfigType.OTHER.getKey().equals(configType)) {
            getConfigInfo4Other(configDto);
        }
        // 冲突配置
        else if (ConstantsUtil.ConfigType.CONFLICT.getKey().equals(configType)) {
            configDto = getConfigInfo4Conflict();
        } else if (ConstantsUtil.ConfigType.INTERFACE.getKey().equals(configType) || ConstantsUtil.ConfigType.CUSTOM_LIST.getKey().equals(configType)) {
            configDto = getConfigInfo4Interface();
        } else if (ConstantsUtil.ConfigType.PRINT.getKey().equals(configType)) {
            // todo 获取打印相关配置
            configDto = getConfigInfo4Print();
        } else if (ConstantsUtil.ConfigType.SEARCHES_FORM.getKey().equals(configType)) {
            // todo 获取检索和表格相关配置
            getConfigInfo4SearchesForm(configDto);
        }

        return JsonResultUtil.success("成功", configDto);
    }

    private ConfigDto getConfigInfo4InfoSync() {
        List<String> paramNameList = new ArrayList<>();
        //传入的ic卡号加前缀
//        paramNameList.add(ConstantsUtil.ConfigName.IC_CARD_PRES.getKey());
        //卡号栏查询支持类型
//        paramNameList.add(ConstantsUtil.ConfigName.IS_IC_CARD_INPUT_NEW_SUPPORT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IC_CARD_INPUT_SUPPORT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.PATIENT_SOURCE_IN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_GET_CHARGE_FLAG_REALTIME.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_GET_ACCOUNT_BALANCE_REALTIME.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_GET_CLINIC_PATH_FLAG_REALTIME.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_NOTIFY_THIRD_AFTER_SCHEDULE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.EXAM_APPLY_INFO_SUPPORT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.GET_CHARGE_FLAG_REALTIME_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.GET_ACCOUNT_BALANCE_REALTIME_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_GET_REFER_PATIENT_INFO.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_VIRTUAL_CARD_READER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.VIRTUAL_CARD_READER_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_INPUT_NEW_SUPPORT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_UPPER_CASE_INPUT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.HTTP_TIMEOUT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_TOKEN_OAUTH_BY_CLINIC.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.OPEN_THIRD_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_MESSAGE_ALERT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_MESSAGE_ALERT_BY_WARD.getKey());
        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
        ConfigDto configDto = null;
        if (CollectionUtils.isNotEmpty(dictSysparamsList)) {
            configDto = new ConfigDto();
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.IC_CARD_PRES.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.IcCardPreScope> icCardPreScopeList = JsonUtil.toList(param.getParamValue(), ConfigDto.IcCardPreScope.class);
                    if (icCardPreScopeList != null && !icCardPreScopeList.isEmpty()) {
                        configDto.setIcCardPres(icCardPreScopeList);
                    }
                }
                //
                if (ConstantsUtil.ConfigName.IC_CARD_INPUT_SUPPORT.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setIcCardInputSupport(CommonUtil.split2List(param.getParamValue()));
                }
                //
                if (ConstantsUtil.ConfigName.PATIENT_SOURCE_IN.getKey().equals(param.getParamName())) {
                    configDto.setPatientSourceIn(configVal(param.getParamValue(), "住院"));
                }
                if (ConstantsUtil.ConfigName.IS_GET_CHARGE_FLAG_REALTIME.getKey().equals(param.getParamName())) {
                    configDto.setIsGetChargeFlagRealTime(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_GET_ACCOUNT_BALANCE_REALTIME.getKey().equals(param.getParamName())) {
                    configDto.setIsGetAccountBalanceRealTime(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_GET_CLINIC_PATH_FLAG_REALTIME.getKey().equals(param.getParamName())) {
                    configDto.setIsGetClinicPathFlagRealTime(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_NOTIFY_THIRD_AFTER_SCHEDULE.getKey().equals(param.getParamName())) {
                    ConfigDto.NotifyThirdAfterSchedule notifyThirdAfterSchedule = JsonUtil.toBean(param.getParamValue(), ConfigDto.NotifyThirdAfterSchedule.class);
                    if (notifyThirdAfterSchedule != null) {
                        configDto.setIsNotifyThirdAfterSchedule(notifyThirdAfterSchedule);
                    }
                }
                if (ConstantsUtil.ConfigName.EXAM_APPLY_INFO_SUPPORT.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setExamApplyInfoSupport(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.GET_CHARGE_FLAG_REALTIME_URL.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setGetChargeFlagRealTimeUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.GET_ACCOUNT_BALANCE_REALTIME_URL.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setGetAccountBalanceRealTimeUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.IS_IC_CARD_INPUT_NEW_SUPPORT.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamName())) {
                    ConfigDto.IcCardInputNewSupport icCardInputNewSupport = JsonUtil.toBean(param.getParamValue(), ConfigDto.IcCardInputNewSupport.class);
                    if (icCardInputNewSupport != null) {
                        configDto.setIsIcCardInputNewSupport(icCardInputNewSupport);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_GET_REFER_PATIENT_INFO.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamName())) {
                    ConfigDto.GetReferPatientInfo isGetReferPatientInfo = JsonUtil.toBean(param.getParamValue(), ConfigDto.GetReferPatientInfo.class);
                    if (isGetReferPatientInfo != null) {
                        configDto.setIsGetReferPatientInfo(isGetReferPatientInfo);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_VIRTUAL_CARD_READER.getKey().equals(param.getParamName())) {
                    configDto.setIsVirtualCardReader(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.VIRTUAL_CARD_READER_URL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setVirtualCardReaderUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.IS_INPUT_NEW_SUPPORT.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.InputNewSupport inputNewSupport = JsonUtil.toBean(param.getParamValue(), ConfigDto.InputNewSupport.class);
                    if (inputNewSupport != null) {
                        configDto.setIsInputNewSupport(inputNewSupport);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_UPPER_CASE_INPUT.getKey().equals(param.getParamName())) {
                    configDto.setIsUpperCaseInput(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.HTTP_TIMEOUT.getKey().equals(param.getParamName())) {
                    configDto.setHttpTimeOut(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : null);
                }
                if (ConstantsUtil.ConfigName.IS_TOKEN_OAUTH_BY_CLINIC.getKey().equals(param.getParamName())) {
                    configDto.setIsTokenOauthByClinic(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.OPEN_THIRD_URL.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamName())) {
                    List<ConfigDto.CommonSet> openThirdUrlSetList = JsonUtil.toList(param.getParamValue(), ConfigDto.CommonSet.class);
                    if (openThirdUrlSetList != null && !openThirdUrlSetList.isEmpty()) {
                        configDto.setOpenThirdUrl(openThirdUrlSetList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_MESSAGE_ALERT.getKey().equals(param.getParamName())) {
                    configDto.setIsMessageAlert(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_MESSAGE_ALERT_BY_WARD.getKey().equals(param.getParamName())) {
                    configDto.setIsMessageAlertByWard(configVal(param.getParamValue(), "1"));
                }
            }
        }
        return configDto;
    }

    private ConfigDto getConfigInfo4Schedule(ConfigDto configDto) {
        List<String> paramNameList = new ArrayList<>();
        paramNameList.add(ConstantsUtil.ConfigName.IS_DEPT_WARD_DEFAULT_BY_TERMINAL_TYPE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_EDIT_DEPT_WARD_LIMIT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.REQ_DATE_DEFAULT_BY_SCHEDULE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.REQ_DATE_DEFAULT_BY_QUERY.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NOT_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SHOW_CHARGE_FLAG.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_CONFIRM_FEE_BEFORE_SCHEDULE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_AFTER_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_FIRST_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_FIRST_PATIENT_SOURCE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE_MIN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.AUTO_SCHEDULE_DELAY_TIME.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_VALID_DATE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_CANCEL_FLAG.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SCHEDULE_PLAN_BY_DEPTSCHE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SCHEDULE_PLAN_BY_CLINIC.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SCHEDULE_QUERY_TO_CLINIC.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SHOW_NOTICE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_RECORD_NOTES_BY_CANCEL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.ORGAN_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.SPAN_HOSPITAL_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.EXPIRE_DAY_BY_PATIENT_SOURCE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.TRANS_TOOL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.SELF_REQ_DATE_LIMIT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_RECEDE_COST_BY_CANCEL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_AFTER_SCHEDULE_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.MERGE_ITEM.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_FREE_SOURCE_BY_CANCEL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_SHOW_UN_SCHEDULE_ITEM_BY_TERMINAL_TYPE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SPAN_HOSPITAL_EXAM_CLASS_BY_GREEN_CHANNEL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHECKOUT_PHONE_NUMBER_BY_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SHOW_APPLY_NUMBER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE_BY_TIME.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.FIRST_SCHE_PRIORITY_QUEUE_BY_ONE_DAY.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.SELF_ACT_LIMIT.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NEED_CLAM_AGE_BY_ITEM.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_FIRST_SCHEDULE_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_CONFIRM_SCHEDULE_BY_IGNORE_DIALOG.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.SCHEDULE_LIMIT_BY_TERMINAL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_PATIENT_SOURCE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_NOT_UPDATE_CHARGE_FLAG_BY_CONFIRM_FEE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_NOT_UPDATE_CHARGE_FLAG_BY_RECEDE_COST.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_OPEN_DEL_APPLY_BTN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.ONLY_MATCH_APM_BY_CLAM_APPLY.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_NEED_PASSWORD_BY_DEPTSCHE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NEED_PASSWORD_EXAM_CLASS_BY_DEPTSCHE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_FIRST_TERMINAL_TYPE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_SHOW_ONLY_DEPTSCHE_SCHEDULE_BY_TERMINAL_TYPE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_AUTO_SCHEDULE_BY_TIMING_TASK.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.AUTO_SCHEDULE_BY_TIMING_TASK.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.GET_HIS_APPLY_BY_HOSPITAL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.SCHEDULE_STATUS_BY_CONFIRM_FEE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SCAN_BTN_BY_SCHEDULE_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_DYNAMIC_SOURCE.getKey());

        // 预约凭条设置
//        paramNameList.add(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SCHEDULE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SCHEDULE.getKey());

        // 患者预约需要审核的检查项目
//        paramNameList.add(ConstantsUtil.ConfigName.NEED_CONFIRM_ITEM.getKey());

        // 第三方HIS申请单设置
//        paramNameList.add(ConstantsUtil.ConfigName.IS_GET_HIS_APPLY_BY_THIRD_WS.getKey());

        // 预约生成排队号
//        paramNameList.add(ConstantsUtil.ConfigName.QUEUE_NO_CLASS.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.NO_REGULAR_QUEUE_NO_CLASS.getKey());

        // 需要在预约前选择更新无痛标识的项目
//        paramNameList.add(ConstantsUtil.ConfigName.EDIT_ITEM_FLAG_BEFORE_SCHEDULE.getKey());

        // 短信通知
//        paramNameList.add(ConstantsUtil.ConfigName.IS_SMS_NOTICE_FOR_SCHEDULE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.IS_SMS_NOTICE_FOR_DEL_SCHEDULE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.SMS_NOTICE_PATIENT_SOURCE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.SMS_NOTICE_QUEUE.getKey());

        // 条码打印设置
//        paramNameList.add(ConstantsUtil.ConfigName.CLICK_BTN_BY_PRINT_NUM.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_AFTER_SCHEDULE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_BY_ITEM.getKey());

        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
//        ConfigDto configDto = null;
        if (dictSysparamsList != null && dictSysparamsList.size() > 0) {
//            configDto = new ConfigDto();
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.IS_DEPT_WARD_DEFAULT_BY_TERMINAL_TYPE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.DeptWardDefaultByTerminalType deptWardDefaultByTerminalType = JsonUtil.toBean(param.getParamValue(), ConfigDto.DeptWardDefaultByTerminalType.class);
                    if (deptWardDefaultByTerminalType != null) {
                        configDto.setIsDeptWardDefaultByTerminalType(deptWardDefaultByTerminalType);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_EDIT_DEPT_WARD_LIMIT.getKey().equals(param.getParamName())) {
                    configDto.setIsEditDeptWardLimit(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.REQ_DATE_DEFAULT_BY_SCHEDULE.getKey().equals(param.getParamName())) {
                    configDto.setReqDateDefaultBySchedule(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 0);
                }
                if (ConstantsUtil.ConfigName.REQ_DATE_DEFAULT_BY_QUERY.getKey().equals(param.getParamName())) {
                    configDto.setReqDateDefaultByQuery(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 0);
                }
                if (ConstantsUtil.ConfigName.NOT_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNotExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_SHOW_CHARGE_FLAG.getKey().equals(param.getParamName())) {
                    configDto.setIsShowChargeFlag(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.CHARGE_AFTER_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeAfterExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.CHARGE_FIRST_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeFirstExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.CHARGE_FIRST_PATIENT_SOURCE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeFirstPatientSource(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE_MIN.getKey().equals(param.getParamName())) {
                    configDto.setCancelScheduleNoChargeMin(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 180);
                }
                if (ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.CancelScheduleNoCharge> cancelScheduleNoChargeList = JsonUtil.toList(param.getParamValue(), ConfigDto.CancelScheduleNoCharge.class);
                    if (cancelScheduleNoChargeList != null && !cancelScheduleNoChargeList.isEmpty()) {
                        configDto.setCancelScheduleNoCharge(cancelScheduleNoChargeList);
                    }
                }
                if (ConstantsUtil.ConfigName.ORGAN_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setOrganExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.SPAN_HOSPITAL_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setSpanHospitalExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.AUTO_SCHEDULE_DELAY_TIME.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.AutoScheduleDelayTime autoScheduleDelayTime = JsonUtil.toBean(param.getParamValue(), ConfigDto.AutoScheduleDelayTime.class);
                    if (autoScheduleDelayTime != null) {
                        configDto.setAutoScheduleDelayTime(autoScheduleDelayTime);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_VALID_DATE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.ValidDate validDate = JsonUtil.toBean(param.getParamValue(), ConfigDto.ValidDate.class);
                    if (validDate != null) {
                        configDto.setIsValidDate(validDate);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_CANCEL_FLAG.getKey().equals(param.getParamName())) {
                    configDto.setIsCancelFlag(StringUtils.isNotBlank(param.getParamValue()) ? param.getParamValue() : "1");
                }
                if (ConstantsUtil.ConfigName.IS_SCHEDULE_PLAN_BY_DEPTSCHE.getKey().equals(param.getParamName())) {
                    configDto.setIsSchedulePlanByDeptsche(configVal(param.getParamValue(), "0"));
                }
                if (ConstantsUtil.ConfigName.IS_SCHEDULE_PLAN_BY_CLINIC.getKey().equals(param.getParamName())) {
                    configDto.setIsSchedulePlanByClinic(configVal(param.getParamValue(), "0"));
                }
                if (ConstantsUtil.ConfigName.IS_SCHEDULE_QUERY_TO_CLINIC.getKey().equals(param.getParamName())) {
                    configDto.setIsScheduleQueryToClinic(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_SHOW_NOTICE.getKey().equals(param.getParamName())) {
                    configDto.setIsShowNotice(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.SELF_REQ_DATE_LIMIT.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.SelfReqDateLimit> selfReqDateLimitList = JsonUtil.toList(param.getParamValue(), ConfigDto.SelfReqDateLimit.class);
                    if (selfReqDateLimitList != null && !selfReqDateLimitList.isEmpty()) {
                        configDto.setSelfReqDateLimit(selfReqDateLimitList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_RECORD_NOTES_BY_CANCEL.getKey().equals(param.getParamName())) {
                    configDto.setIsRecordNotesByCancel(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.EXPIRE_DAY_BY_PATIENT_SOURCE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.ExpireDayByPatientSource> expireDayByPatientSourceList = JsonUtil.toList(param.getParamValue(), ConfigDto.ExpireDayByPatientSource.class);
                    if (expireDayByPatientSourceList != null && !expireDayByPatientSourceList.isEmpty()) {
                        configDto.setExpireDayByPatientSource(expireDayByPatientSourceList);
                    }
                }
                if (ConstantsUtil.ConfigName.TRANS_TOOL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setTransTool(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_SMS_NOTICE_FOR_SCHEDULE.getKey().equals(param.getParamName())) {
                    configDto.setIsSmsNoticeForSchedule(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_SMS_NOTICE_FOR_DEL_SCHEDULE.getKey().equals(param.getParamName())) {
                    configDto.setIsSmsNoticeForDelSchedule(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.SMS_NOTICE_PATIENT_SOURCE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setSmsNoticePatientSource(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.SMS_NOTICE_QUEUE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<DictExamQueue> queueList = JsonUtil.toList(param.getParamValue(), DictExamQueue.class);
                    if (queueList != null && !queueList.isEmpty()) {
                        configDto.setSmsNoticeQueue(queueList);
                    }
                }
                if (ConstantsUtil.ConfigName.NEED_CONFIRM_ITEM.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<DictExamItem> itemList = JsonUtil.toList(param.getParamValue(), DictExamItem.class);
                    if (itemList != null && !itemList.isEmpty()) {
                        configDto.setNeedConfirmItem(itemList);
                    }
                }
                if (ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SCHEDULE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.PrintTicketAfterSchedule> printTicketAfterScheduleList = JsonUtil.toList(param.getParamValue(), ConfigDto.PrintTicketAfterSchedule.class);
                    if (printTicketAfterScheduleList != null) {
                        configDto.setPrintTicketAfterSchedule(printTicketAfterScheduleList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_GET_HIS_APPLY_BY_THIRD_WS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.GetHisApplyByThirdWS getHisApplyByThirdWS = JsonUtil.toBean(param.getParamValue(), ConfigDto.GetHisApplyByThirdWS.class);
                    if (getHisApplyByThirdWS != null) {
                        configDto.setIsGetHisApplyByThirdWS(getHisApplyByThirdWS);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_RECEDE_COST_BY_CANCEL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.RecedeCostByCancel recedeCostByCancel = JsonUtil.toBean(param.getParamValue(), ConfigDto.RecedeCostByCancel.class);
                    if (recedeCostByCancel != null) {
                        configDto.setIsRecedeCostByCancel(recedeCostByCancel);
                    }
                }
                if (ConstantsUtil.ConfigName.CHARGE_AFTER_SCHEDULE_URL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeAfterScheduleUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.CHARGE_FIRST_SCHEDULE_URL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeFirstScheduleUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SCHEDULE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.PrintTicketAfterSchedule> remindPrintTicketAfterScheduleList = JsonUtil.toList(param.getParamValue(), ConfigDto.PrintTicketAfterSchedule.class);
                    if (remindPrintTicketAfterScheduleList != null) {
                        configDto.setRemindPrintTicketAfterSchedule(remindPrintTicketAfterScheduleList);
                    }
                }
                if (ConstantsUtil.ConfigName.MERGE_ITEM.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.MergeItem> mergeItemList = JsonUtil.toList(param.getParamValue(), ConfigDto.MergeItem.class);
                    if (mergeItemList != null && !mergeItemList.isEmpty()) {
                        for (ConfigDto.MergeItem mergeItem : mergeItemList) {
                            if (StringUtils.isNotBlank(mergeItem.getMergeDateTime())) {
                                mergeItem.setMergeDateLimit(Integer.parseInt(mergeItem.getMergeDateTime()));
                            }
                        }
                        configDto.setMergeItem(mergeItemList);
                    }
                }
                if (ConstantsUtil.ConfigName.QUEUE_NO_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setQueueNoByExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.NO_FREE_SOURCE_BY_CANCEL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.NoFreeSourceByCancel> noFreeSourceByCancelList = (List<ConfigDto.NoFreeSourceByCancel>) JsonUtil.toList(param.getParamValue(), ConfigDto.NoFreeSourceByCancel.class);
                    if (noFreeSourceByCancelList != null && !noFreeSourceByCancelList.isEmpty()) {
                        for (ConfigDto.NoFreeSourceByCancel noFreeSourceByCancel : noFreeSourceByCancelList) {
                            if (StringUtils.isNotBlank(noFreeSourceByCancel.getLeadTime())) {
                                String leadTime = noFreeSourceByCancel.getLeadTime();
                                Integer leadValue = 0;
                                String leadUnit = "天";
                                if (leadTime.endsWith("天")) {
                                    leadValue = Integer.parseInt(leadTime.substring(0, leadTime.lastIndexOf("天")));
                                    leadUnit = leadTime.substring(leadTime.lastIndexOf("天"));
                                } else {
                                    leadValue = Integer.parseInt(leadTime.substring(0, leadTime.lastIndexOf("小时")));
                                    leadUnit = leadTime.substring(leadTime.lastIndexOf("小时"));
                                }
                                noFreeSourceByCancel.setLeadValue(leadValue);
                                noFreeSourceByCancel.setLeadUnit(leadUnit);
                            }
                        }
                        configDto.setNoFreeSourceByCancel(noFreeSourceByCancelList);
                    }
                }
                if (ConstantsUtil.ConfigName.NO_REGULAR_QUEUE_NO_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoRegularQueueNoClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.EDIT_ITEM_FLAG_BEFORE_SCHEDULE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<DictExamItem> itemList = JsonUtil.toList(param.getParamValue(), DictExamItem.class);
                    if (itemList != null && !itemList.isEmpty()) {
                        configDto.setEditItemFlagBeforeSchedule(itemList);
                    }
                }
                if (ConstantsUtil.ConfigName.NO_SHOW_UN_SCHEDULE_ITEM_BY_TERMINAL_TYPE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoShowUnScheduleItemByTerminalType(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_SPAN_HOSPITAL_EXAM_CLASS_BY_GREEN_CHANNEL.getKey().equals(param.getParamName())) {
                    configDto.setIsSpanHospitalExamClassByGreenChannel(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.CHECKOUT_PHONE_NUMBER_BY_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCheckOutPhoneNumberByExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_SHOW_APPLY_NUMBER.getKey().equals(param.getParamName())) {
                    configDto.setIsShowApplyNumber(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE_BY_TIME.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.CancelScheduleNoCharge> cancelScheduleNoChargeList = JsonUtil.toList(param.getParamValue(), ConfigDto.CancelScheduleNoCharge.class);
                    if (cancelScheduleNoChargeList != null && !cancelScheduleNoChargeList.isEmpty()) {
                        configDto.setCancelScheduleNoChargeByTime(cancelScheduleNoChargeList);
                    }
                }
                if (ConstantsUtil.ConfigName.FIRST_SCHE_PRIORITY_QUEUE_BY_ONE_DAY.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setFirstSchePriorityQueueByOneDay(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.SELF_ACT_LIMIT.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.SelfActLimit> selfActLimitList = JsonUtil.toList(param.getParamValue(), ConfigDto.SelfActLimit.class);
                    if (selfActLimitList != null && !selfActLimitList.isEmpty()) {
                        for (ConfigDto.SelfActLimit selfActLimit : selfActLimitList) {
                            if (selfActLimit != null && StringUtils.isNotBlank(selfActLimit.getLimitTime())) {
                                String limitTime = selfActLimit.getLimitTime();
                                String limitValue = "";
                                String limitUnit = "天";
                                if (limitTime.endsWith("天")) {
                                    limitValue = limitTime.substring(0, limitTime.lastIndexOf("天"));
                                    limitUnit = limitTime.substring(limitTime.lastIndexOf("天"));
                                } else {
                                    limitValue = limitTime.substring(0, limitTime.lastIndexOf("小时"));
                                    limitUnit = limitTime.substring(limitTime.lastIndexOf("小时"));
                                }
                                selfActLimit.setLimitValue(limitValue);
                                selfActLimit.setLimitUnit(limitUnit);
                            }
                        }
                        configDto.setSelfActLimit(selfActLimitList);
                    }
                }
                if (ConstantsUtil.ConfigName.NEED_CLAM_AGE_BY_ITEM.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.NeedClamAgeByItem> needClamAgeByItemList = JsonUtil.toList(param.getParamValue(), ConfigDto.NeedClamAgeByItem.class);
                    if (!needClamAgeByItemList.isEmpty()) {
                        configDto.setNeedClamAgeByItem(needClamAgeByItemList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_CONFIRM_SCHEDULE_BY_IGNORE_DIALOG.getKey().equals(param.getParamName())) {
                    configDto.setIsConfirmScheduleByIgnoreDialog(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.SCHEDULE_LIMIT_BY_TERMINAL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.ScheduleLimit> scheduleLimitByTerminalList = JsonUtil.toList(param.getParamValue(), ConfigDto.ScheduleLimit.class);
                    if (!scheduleLimitByTerminalList.isEmpty()) {
                        configDto.setScheduleLimitByTerminal(scheduleLimitByTerminalList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_CONFIRM_FEE_BEFORE_SCHEDULE.getKey().equals(param.getParamName())) {
                    configDto.setIsConfirmFeeBeforeSchedule(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_URL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setConfirmFeeBeforeScheduleUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setConfirmFeeBeforeScheduleExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_PATIENT_SOURCE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setConfirmFeeBeforeSchedulePatientSource(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_NOT_UPDATE_CHARGE_FLAG_BY_CONFIRM_FEE.getKey().equals(param.getParamName())) {
                    configDto.setIsNotUpdateChargeFlagByConfirmFee(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_NOT_UPDATE_CHARGE_FLAG_BY_RECEDE_COST.getKey().equals(param.getParamName())) {
                    configDto.setIsNotUpdateChargeFlagByRecedeCost(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_OPEN_DEL_APPLY_BTN.getKey().equals(param.getParamName())) {
                    configDto.setIsOpenDelApplyBtn(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.ONLY_MATCH_APM_BY_CLAM_APPLY.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.CommonSet> commonSetList = JsonUtil.toList(param.getParamValue(), ConfigDto.CommonSet.class);
                    if (CollectionUtils.isNotEmpty(commonSetList)) {
                        for (ConfigDto.CommonSet commonSet : commonSetList) {
                            if (commonSet != null && StringUtils.isNotBlank(commonSet.getLimitTime()) && StringUtils.isBlank(commonSet.getValue()) && StringUtils.isBlank(commonSet.getUnit())) {
                                String limitTime = commonSet.getLimitTime();
                                String value;
                                String unit;
                                if (limitTime.endsWith("天")) {
                                    value = limitTime.substring(0, limitTime.lastIndexOf("天"));
                                    unit = limitTime.substring(limitTime.lastIndexOf("天"));
                                } else {
                                    value = limitTime.substring(0, limitTime.lastIndexOf("小时"));
                                    unit = limitTime.substring(limitTime.lastIndexOf("小时"));
                                }
                                commonSet.setValue(value);
                                commonSet.setUnit(unit);
                            }
                        }
                        configDto.setOnlyMatchApmByClamApply(commonSetList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_NEED_PASSWORD_BY_DEPTSCHE.getKey().equals(param.getParamName())) {
                    configDto.setIsNeedPasswordByDeptsche(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.NEED_PASSWORD_EXAM_CLASS_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNeedPasswordExamClassByDeptsche(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.CHARGE_FIRST_TERMINAL_TYPE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeFirstTerminalType(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.NO_SHOW_ONLY_DEPTSCHE_SCHEDULE_BY_TERMINAL_TYPE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoShowOnlyDeptscheScheduleByTerminalType(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_AUTO_SCHEDULE_BY_TIMING_TASK.getKey().equals(param.getParamName())) {
                    configDto.setIsAutoScheduleByTimingTask(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.AUTO_SCHEDULE_BY_TIMING_TASK.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamName())) {
                    List<ConfigDto.CommonSet> autoScheduleSetList = JsonUtil.toList(param.getParamValue(), ConfigDto.CommonSet.class);
                    if (autoScheduleSetList != null && !autoScheduleSetList.isEmpty()) {
                        configDto.setAutoScheduleByTimingTask(autoScheduleSetList);
                    }
                }
                if (ConstantsUtil.ConfigName.GET_HIS_APPLY_BY_HOSPITAL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setGetHisApplyByHospital(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.SCHEDULE_STATUS_BY_CONFIRM_FEE.getKey().equals(param.getParamName())) {
                    configDto.setScheduleStatusByConfirmFee(configVal(param.getParamValue(), "0"));
                }
                if (ConstantsUtil.ConfigName.CLICK_BTN_BY_PRINT_NUM.getKey().equals(param.getParamName())) {
                    configDto.setClickBtnByPrintNum(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 1);
                }
                if (ConstantsUtil.ConfigName.AUTO_PRINT_NUM_AFTER_SCHEDULE.getKey().equals(param.getParamName())) {
                    configDto.setAutoPrintNumAfterSchedule(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 1);
                }
                if (ConstantsUtil.ConfigName.AUTO_PRINT_NUM_BY_ITEM.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<DictExamItem> itemList = JsonUtil.toList(param.getParamValue(), DictExamItem.class);
                    if (itemList != null && !itemList.isEmpty()) {
                        configDto.setAutoPrintNumByItem(itemList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_SCAN_BTN_BY_SCHEDULE_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsScanBtnByScheduleSign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_DYNAMIC_SOURCE.getKey().equals(param.getParamName())) {
                    configDto.setIsDynamicSource(configVal(param.getParamValue(), "1"));
                }
            }
        }
        return configDto;
    }

    private ConfigDto getConfigInfo4Print() {
        List<String> paramNameList = new ArrayList<>();
        // 预约凭条设置
        paramNameList.add(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SCHEDULE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SCHEDULE.getKey());

        // 报到凭条设置
        // 报到成功后自动打印凭条
        paramNameList.add(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SIGN.getKey());
        // 报到成功后是否提醒打印凭条
        paramNameList.add(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SIGN.getKey());

        // 条码打印设置
        paramNameList.add(ConstantsUtil.ConfigName.CLICK_BTN_BY_PRINT_NUM.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_AFTER_SCHEDULE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_BY_ITEM.getKey());

        // 预约凭条提示报到时间类型
        paramNameList.add(ConstantsUtil.ConfigName.ADVANCE_TIME_TYPE_BY_SCHEDULE_PRINT.getKey());
        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
        ConfigDto configDto = null;
        if (dictSysparamsList != null && dictSysparamsList.size() > 0) {
            configDto = new ConfigDto();
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SCHEDULE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.PrintTicketAfterSchedule> remindPrintTicketAfterScheduleList = JsonUtil.toList(param.getParamValue(), ConfigDto.PrintTicketAfterSchedule.class);
                    if (remindPrintTicketAfterScheduleList != null) {
                        configDto.setRemindPrintTicketAfterSchedule(remindPrintTicketAfterScheduleList);
                    }
                }
                if (ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SCHEDULE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.PrintTicketAfterSchedule> printTicketAfterScheduleList = JsonUtil.toList(param.getParamValue(), ConfigDto.PrintTicketAfterSchedule.class);
                    if (printTicketAfterScheduleList != null) {
                        configDto.setPrintTicketAfterSchedule(printTicketAfterScheduleList);
                    }
                }
                if (ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.PrintTicketAfterSign> printTicketAfterSignList = JsonUtil.toList(param.getParamValue(), ConfigDto.PrintTicketAfterSign.class);
                    if (printTicketAfterSignList != null) {
                        configDto.setPrintTicketAfterSign(printTicketAfterSignList);
                    }
                }
                if (ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.PrintTicketAfterSign> remindPrintTicketAfterSignList = JsonUtil.toList(param.getParamValue(), ConfigDto.PrintTicketAfterSign.class);
                    if (remindPrintTicketAfterSignList != null) {
                        configDto.setRemindPrintTicketAfterSign(remindPrintTicketAfterSignList);
                    }
                }
                if (ConstantsUtil.ConfigName.CLICK_BTN_BY_PRINT_NUM.getKey().equals(param.getParamName())) {
                    configDto.setClickBtnByPrintNum(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 1);
                }
                if (ConstantsUtil.ConfigName.AUTO_PRINT_NUM_AFTER_SCHEDULE.getKey().equals(param.getParamName())) {
                    configDto.setAutoPrintNumAfterSchedule(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 1);
                }
                if (ConstantsUtil.ConfigName.AUTO_PRINT_NUM_BY_ITEM.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<DictExamItem> itemList = JsonUtil.toList(param.getParamValue(), DictExamItem.class);
                    if (itemList != null && !itemList.isEmpty()) {
                        configDto.setAutoPrintNumByItem(itemList);
                    }
                }
                if (ConstantsUtil.ConfigName.ADVANCE_TIME_TYPE_BY_SCHEDULE_PRINT.getKey().equals(param.getParamName())) {
                    configDto.setAdvanceTimeTypeBySchedulePrint(configVal(param.getParamValue(), "3"));
                }
            }
        }
        return configDto;
    }

    private ConfigDto getConfigInfo4Sign() {
        List<String> paramNameList = new ArrayList<String>();
        // 基本设置
        paramNameList.add(ConstantsUtil.ConfigName.IS_CONFIRM_FEE_BEFORE_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_PATIENT_SOURCE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_RECEDE_COST_BY_RESET.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_CLICK_SIGN_BTN_BY_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.REPEAT_SIGN_BY_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SCHEDULE_TODAY_BY_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SHOW_INFO_DIALOG_BY_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_ADVANCE_TIME_FOR_NIGHT_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SIGNIN_TIME_NO_LIMIT.getKey());
        // 不报到设置
        paramNameList.add(ConstantsUtil.ConfigName.IS_NO_CHARGE_NO_SIGN.getKey());

        /* 数据库已无此配置
        paramNameList.add(ConstantsUtil.ConfigName.IS_CHARGE_AFTER_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SCHEDULE_INTERVAL_BY_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SCANNER_AFTER_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_AFTER_SIGN_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CHARGE_AFTER_EXAM_CLASS_BY_SIGN.getKey());*/

        // 第三方报到设置
        // 启用通过第三方 RIS 提供的接口报到
//        paramNameList.add(ConstantsUtil.ConfigName.IS_SIGN_SCHEDULE_BY_THIRD_WS.getKey());

        // 预约取号设置
        // 启用预约后就取号
//        paramNameList.add(ConstantsUtil.ConfigName.IS_TAKE_NO_QUEUE.getKey());

        // 报到凭条设置
        // 报到成功后自动打印凭条
//        paramNameList.add(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SIGN.getKey());
        // 报到成功后是否提醒打印凭条
//        paramNameList.add(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SIGN.getKey());

        // 提前检查释放号源
//        paramNameList.add(ConstantsUtil.ConfigName.FREE_SOURCE_BY_EARLY_SIGN.getKey());
        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
        ConfigDto configDto = null;
        if (dictSysparamsList != null && dictSysparamsList.size() > 0) {
            configDto = new ConfigDto();
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.IS_CHARGE_AFTER_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.ChargeAfterSign chargeAfterSign = JsonUtil.toBean(param.getParamValue(), ConfigDto.ChargeAfterSign.class);
                    if (chargeAfterSign != null) {
                        configDto.setIsChargeAfterSign(chargeAfterSign);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_SCHEDULE_INTERVAL_BY_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsScheduleIntervalBySign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_SCANNER_AFTER_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsScannerAfterSign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_SCHEDULE_TODAY_BY_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.ScheduleTodayBySign scheduleTodayBySign = JsonUtil.toBean(param.getParamValue(), ConfigDto.ScheduleTodayBySign.class);
                    if (scheduleTodayBySign != null) {
                        configDto.setIsScheduleTodayBySign(scheduleTodayBySign);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_SHOW_INFO_DIALOG_BY_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsShowInfoDialogBySign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_ADVANCE_TIME_FOR_NIGHT_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.AdvanceTimeForNightSign advanceTimeForNightSign = JsonUtil.toBean(param.getParamValue(), ConfigDto.AdvanceTimeForNightSign.class);
                    if (advanceTimeForNightSign != null) {
                        configDto.setIsAdvanceTimeForNightSign(advanceTimeForNightSign);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_SIGN_SCHEDULE_BY_THIRD_WS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.SignScheduleByThirdWS signScheduleByThirdWS = JsonUtil.toBean(param.getParamValue(), ConfigDto.SignScheduleByThirdWS.class);
                    if (signScheduleByThirdWS != null) {
                        configDto.setIsSignScheduleByThirdWS(signScheduleByThirdWS);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_TAKE_NO_QUEUE.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.TakeNoQueue takeNoQueue = JsonUtil.toBean(param.getParamValue(), ConfigDto.TakeNoQueue.class);
                    if (takeNoQueue != null) {
                        configDto.setIsTakeNoQueue(takeNoQueue);
                    }
                }

                if (ConstantsUtil.ConfigName.IS_RECEDE_COST_BY_RESET.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.RecedeCostByReSet recedeCostByReSet = JsonUtil.toBean(param.getParamValue(), ConfigDto.RecedeCostByReSet.class);
                    if (recedeCostByReSet != null) {
                        configDto.setIsRecedeCostByReSet(recedeCostByReSet);
                    }
                }
                if (ConstantsUtil.ConfigName.CHARGE_AFTER_SIGN_URL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeAfterSignUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.CHARGE_AFTER_EXAM_CLASS_BY_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setChargeAfterExamClassBySign(CommonUtil.split2List(param.getParamValue()));
                }

                if (ConstantsUtil.ConfigName.FREE_SOURCE_BY_EARLY_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.FreeSourceByEarlySign> freeSourceByEarlySignList = JsonUtil.toList(param.getParamValue(), ConfigDto.FreeSourceByEarlySign.class);
                    if (freeSourceByEarlySignList != null && !freeSourceByEarlySignList.isEmpty()) {
                        for (ConfigDto.FreeSourceByEarlySign freeSourceByEarlySign : freeSourceByEarlySignList) {
                            if (StringUtils.isNotBlank(freeSourceByEarlySign.getLeadTime())) {
                                String leadTime = freeSourceByEarlySign.getLeadTime();
                                float leadValue = 0;
                                String leadUnit = "天";
                                if (leadTime.endsWith("天")) {
                                    leadValue = Float.parseFloat(leadTime.substring(0, leadTime.lastIndexOf("天")));
                                    leadUnit = leadTime.substring(leadTime.lastIndexOf("天"));
                                } else {
                                    leadValue = Float.parseFloat(leadTime.substring(0, leadTime.lastIndexOf("小时")));
                                    leadUnit = leadTime.substring(leadTime.lastIndexOf("小时"));
                                }
                                freeSourceByEarlySign.setLeadValue(leadValue);
                                freeSourceByEarlySign.setLeadUnit(leadUnit);
                            }
                        }
                        configDto.setFreeSourceByEarlySign(freeSourceByEarlySignList);
                    }
                }
                if (ConstantsUtil.ConfigName.NO_CLICK_SIGN_BTN_BY_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoClickSignBtnByExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.REPEAT_SIGN_BY_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setRepeatSignByExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_CONFIRM_FEE_BEFORE_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsConfirmFeeBeforeSign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_URL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setConfirmFeeBeforeSignUrl(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setConfirmFeeBeforeSignExamClass(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_PATIENT_SOURCE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setConfirmFeeBeforeSignPatientSource(CommonUtil.split2List(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.IS_NO_CHARGE_NO_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsNoChargeNoSign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_SIGNIN_TIME_NO_LIMIT.getKey().equals(param.getParamName())) {
                    configDto.setIsSignInTimeNoLimit(configVal(param.getParamValue(), "1"));
                }
            }
        }
        return configDto;
    }

    private ConfigDto getConfigInfo4Other(ConfigDto configDto) {
        List<String> paramNameList = new ArrayList<String>();
//        paramNameList.add(ConstantsUtil.ConfigName.ADVANCE_TIME_TYPE_BY_SCHEDULE_PRINT.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.FTP_CONFIG.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SYSTEM_MESSAGE_BOARD.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_READ_CARD.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.DELETE_EXAMS_TYPE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_CHARGE_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.PRINT_EXE_URL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.DIAGNOSTIC_KEYWORD.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SHOW_SHIELD_APPLY_BTN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_SHOW_SOURCE_EDIT_BTN.getKey());
        // 系统登录相关配置
        paramNameList.add(ConstantsUtil.ConfigName.LOGIN_CONFIG.getKey());
        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
        if (dictSysparamsList != null && dictSysparamsList.size() > 0) {
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.IS_SYSTEM_MESSAGE_BOARD.getKey().equals(param.getParamName())) {
                    configDto.setIsSystemMessageBoard(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_READ_CARD.getKey().equals(param.getParamName())) {
                    configDto.setIsReadCard(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.DELETE_EXAMS_TYPE.getKey().equals(param.getParamName())) {
                    configDto.setDeleteExamsType(configVal(param.getParamValue(), "0"));
                }
                if (ConstantsUtil.ConfigName.IS_CHARGE_URL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    ConfigDto.ChargeUrl chargeUrl = JsonUtil.toBean(param.getParamValue(), ConfigDto.ChargeUrl.class);
                    if (chargeUrl != null) {
                        configDto.setIsChargeUrl(chargeUrl);
                    }
                }
                if (ConstantsUtil.ConfigName.PRINT_EXE_URL.getKey().equals(param.getParamName())) {
                    configDto.setPrintExeUrl(configVal(param.getParamValue(), ""));
                }
                if (ConstantsUtil.ConfigName.IS_SHOW_SHIELD_APPLY_BTN.getKey().equals(param.getParamName())) {
                    configDto.setIsShowShieldApplyBtn(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_SHOW_SOURCE_EDIT_BTN.getKey().equals(param.getParamName())) {
                    configDto.setIsShowSourceEditBtn(configVal(param.getParamValue(), "1"));
                }

                if (ConstantsUtil.ConfigName.LOGIN_CONFIG.getKey().equals(param.getParamName())) {
                    Map<String, Object> loginMap = JsonUtil.json2Map(param.getParamValue());
                    if (configDto.getCustomConfig() == null) {
                        configDto.setCustomConfig(new HashMap<>(loginMap));
                    } else {
                        configDto.getCustomConfig().putAll(loginMap);
                    }
                }
                if (ConstantsUtil.ConfigName.DIAGNOSTIC_KEYWORD.getKey().equals(param.getParamName())) {
                    List<ConfigDto.DiagnosticKeyword> diagnosticKeywordList = StringUtils.isNotBlank(param.getParamValue()) ? JsonUtil.toList(param.getParamValue(), ConfigDto.DiagnosticKeyword.class) : new ArrayList<ConfigDto.DiagnosticKeyword>();
                    configDto.setDiagnosticKeyword(diagnosticKeywordList);
                }
            }
        }
        return configDto;
    }

    private ConfigDto getConfigInfo4Conflict() {
        List<String> paramNameList = new ArrayList<>();
        paramNameList.add(ConstantsUtil.ConfigName.NO_CONFLICT_EXAM_CLASS.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_CONFLICT_INTERVAL_TIME.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_NO_ONE_DAY_CLAM.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_NO_ONE_DAY_ENHANCE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_ONE_DAY_CLAM_OR_ENHANCE_ITEM.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.ONE_DAY_ORDER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.ITEM_BEFORE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_NOT_ALLOW_SCHEDULE_BY_CONFLICT.getKey());
        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
        ConfigDto configDto = null;
        if (CollectionUtils.isNotEmpty(dictSysparamsList)) {
            configDto = new ConfigDto();
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.NO_CONFLICT_EXAM_CLASS.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.NoConflictExamClass> noConflictExamClassList = JsonUtil.toList(param.getParamValue(), ConfigDto.NoConflictExamClass.class);
                    if (noConflictExamClassList != null) {
                        configDto.setNoConflictExamClass(noConflictExamClassList);
                    }
                }
                if (ConstantsUtil.ConfigName.NO_CONFLICT_INTERVAL_TIME.getKey().equals(param.getParamName())) {
                    configDto.setNoConflictIntervalTime(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : null);
                }
                if (ConstantsUtil.ConfigName.IS_NO_ONE_DAY_CLAM.getKey().equals(param.getParamName())) {
                    configDto.setIsNoOneDayClamDay(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.IS_NO_ONE_DAY_ENHANCE.getKey().equals(param.getParamName())) {
                    configDto.setIsNoOneDayEnhance(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.NO_ONE_DAY_CLAM_OR_ENHANCE_ITEM.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.NoOneDayClamOrEnhanceItem> noOneDayClamOrEnhanceItemList = JsonUtil.toList(param.getParamValue(), ConfigDto.NoOneDayClamOrEnhanceItem.class);
                    if (CollectionUtils.isNotEmpty(noOneDayClamOrEnhanceItemList)) {
                        configDto.setNoOneDayClamOrEnhanceItem(noOneDayClamOrEnhanceItemList);
                    }
                }
                if (ConstantsUtil.ConfigName.ONE_DAY_ORDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.OneDayOrder> oneDayOrderList = JsonUtil.toList(param.getParamValue(), ConfigDto.OneDayOrder.class);
                    if (oneDayOrderList != null) {
                        configDto.setOneDayOrder(oneDayOrderList);
                    }
                }
                if (ConstantsUtil.ConfigName.ITEM_BEFORE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.ItemBefore> itemBeforeList = JsonUtil.toList(param.getParamValue(), ConfigDto.ItemBefore.class);
                    if (itemBeforeList != null) {
                        configDto.setItemBefore(itemBeforeList);
                    }
                }
                if (ConstantsUtil.ConfigName.IS_NOT_ALLOW_SCHEDULE_BY_CONFLICT.getKey().equals(param.getParamName())) {
                    configDto.setIsNotAllowScheduleByConflict(configVal(param.getParamValue(), "1"));
                }
            }
        }
        return configDto;
    }

    private ConfigDto getConfigInfo4Interface() {
        List<String> paramNameList = new ArrayList<String>();
        // 默认设置
        paramNameList.add(ConstantsUtil.ConfigName.LOGIN_LOGO_PIC.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.FRAME_LOGO_PIC.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.FRAME_NAME.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.REMAIN_SOURCE_TYPE.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.FONT_COLOR.getKey());
        // 提示语
        paramNameList.add(ConstantsUtil.ConfigName.NO_SCHEDULE_ITEM_REMINDER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_QUERY_EXAM_APPLY_REMINDER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_QUEUE_BY_EXAM_CLASS_REMINDER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NOT_ALLOW_EDIT_OR_CANCEL_BEFORE_SCHEDULE_REMINDER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.NO_SIGN_QUEUE_BY_SELF_REMINDER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.LIMIT_SCHEDULE_ITEM_BY_TERMINAL_REMINDER.getKey());
        // 统计分析
        paramNameList.add(ConstantsUtil.ConfigName.STATISTICAL_ANALYSIS_ENTRY.getKey());

        // 默认检索栏及表格栏
//        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_MULTIPLE_QUERY.getKey());
//
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.IS_AUTO_QUERY_BY_SCHEDULE_SIGN.getKey());
//
//        paramNameList.add(ConstantsUtil.ConfigName.AUTO_QUERY_COUNT_BY_SCHEDULE_SIGN.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN_PATIENT_LIST.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_VIRTUAL_ORDER.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_VIRTUAL_ORDER.getKey());

        // 临床端
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_CLINICSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_CLINICSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE_PATIENT_LIST.getKey());

        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
        ConfigDto configDto = new ConfigDto();
        if (dictSysparamsList != null && dictSysparamsList.size() > 0) {
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcel(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.REMAIN_SOURCE_TYPE.getKey().equals(param.getParamName())) {
                    configDto.setRemainSourceType(configVal(param.getParamValue(), "0"));
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelSortSet(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.YY_PRINT_LIST.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setPrintList(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setPrintListSortSet(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.FONT_COLOR.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setFontColor(JsonUtil.json2Map(param.getParamValue()));
                }
                if (ConstantsUtil.ConfigName.STATISTICAL_ANALYSIS_ENTRY.getKey().equals(param.getParamName())
                        && StringUtils.isNotBlank(param.getParamValue())) {
                    List<ConfigDto.MenuSet> menuSetList = JsonUtil.toList(param.getParamValue(), ConfigDto.MenuSet.class);
                    if (CollectionUtils.isNotEmpty(menuSetList)) {
                        List<List<String>> examClassGroupList = new ArrayList<>();
                        Map<String, Object> groupMap = new HashMap<>();
                        List<ConfigDto.MenuSet> menuSetDtoList = null;
                        for (ConfigDto.MenuSet menuSet : menuSetList) {
                            if (menuSet != null && !menuSet.getExamClass().isEmpty()) {
                                if (!examClassGroupList.isEmpty()) {
                                    boolean isTheNewGroup = false;
                                    for (int i = 0; i < examClassGroupList.size(); ++i) {
                                        List<String> groupList = examClassGroupList.get(i);
                                        if (groupList.size() == menuSet.getExamClass().size()) {
                                            List<String> groupBks = new ArrayList<String>();
                                            groupBks.addAll(groupList);
                                            groupBks.retainAll(menuSet.getExamClass());
                                            if (groupBks.size() > 0 && groupList.size() == groupBks.size()) {
                                                isTheNewGroup = false;
                                                String oldGroupName = StringUtils.join(groupBks, "/");
                                                if (groupMap.containsKey(oldGroupName)) {
                                                    List<ConfigDto.MenuSet> oldMenuSetDtoList = (List<ConfigDto.MenuSet>) groupMap.get(oldGroupName);
                                                    oldMenuSetDtoList.add(menuSet);
                                                    groupMap.put(oldGroupName, oldMenuSetDtoList);
                                                    break;
                                                }
                                                menuSetDtoList = new ArrayList<>();
                                                menuSetDtoList.add(menuSet);
                                                groupMap.put(oldGroupName, menuSetDtoList);
                                                break;
                                            } else {
                                                isTheNewGroup = true;
                                            }
                                        } else {
                                            isTheNewGroup = true;
                                        }
                                    }
                                    if (!isTheNewGroup) {
                                        continue;
                                    }
                                    examClassGroupList.add(menuSet.getExamClass());
                                    menuSetDtoList = new ArrayList<>();
                                    menuSetDtoList.add(menuSet);
                                    groupMap.put(StringUtils.join(menuSet.getExamClass(), "/"), menuSetDtoList);
                                } else {
                                    examClassGroupList.add(menuSet.getExamClass());
                                    menuSetDtoList = new ArrayList<ConfigDto.MenuSet>();
                                    menuSetDtoList.add(menuSet);
                                    groupMap.put(StringUtils.join(menuSet.getExamClass(), "/"), menuSetDtoList);
                                }
                            }
                        }
                        configDto.setStatisticalAnalysisEntry(menuSetList);
                        configDto.setStatisticalAnalysisGroupList(groupMap);
                    }
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_VIRTUAL_ORDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelByVirtualOrder(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_VIRTUAL_ORDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelSortSetByVirtualOrder(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.NO_SCHEDULE_ITEM_REMINDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoScheduleItemReminder(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.NO_QUERY_EXAM_APPLY_REMINDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoQueryExamApplyReminder(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.NO_QUEUE_BY_EXAM_CLASS_REMINDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoQueueByExamClassReminder(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.NOT_ALLOW_EDIT_OR_CANCEL_BEFORE_SCHEDULE_REMINDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNotAllowEditOrCancelBeforeScheduleReminder(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByScheduleSign(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_MULTIPLE_QUERY.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByMultipleQuery(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.NO_SIGN_QUEUE_BY_SELF_REMINDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setNoSignQueueBySelfReminder(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.LIMIT_SCHEDULE_ITEM_BY_TERMINAL_REMINDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setLimitScheduleItemByTerminalReminder(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.IS_AUTO_QUERY_BY_SCHEDULE_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsAutoQueryByScheduleSign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.AUTO_QUERY_COUNT_BY_SCHEDULE_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setAutoQueryCountByScheduleSign(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 20);
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByClinicsche(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByDeptsche(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN_PATIENT_LIST.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByScheduleSignPatientList(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE_PATIENT_LIST.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByClinicschePatientList(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.YY_PRINT_LIST_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setPrintListByDeptsche(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setPrintListSortSetByDeptsche(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelByDeptsche(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelSortSetByDeptsche(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.LOGIN_LOGO_PIC.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setLoginLogoPic(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.FRAME_LOGO_PIC.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setFrameLogoPic(param.getParamValue());
                }
                if (ConstantsUtil.ConfigName.FRAME_NAME.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setFrameName(param.getParamValue());
                }
            }
        }
        List<DictSysparamsDto> dictSysparamsDtoList = null;
        DictSysparamsDto dictSysparamsDto = new DictSysparamsDto();
        dictSysparamsDto.setUserId((String) null);
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_SCHEDULE_SIGN.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customSearchToolByScheduleSign = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomSearchToolByScheduleSign(list_customSearchToolByScheduleSign);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_SCHEDULE_SIGN.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByScheduleSign = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByScheduleSign(list_customTableRowByScheduleSign);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_MULTIPLE_QUERY.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customSearchToolByMultipleQuery = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<>();
            configDto.setCustomSearchToolByMultipleQuery(list_customSearchToolByMultipleQuery);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_MULTIPLE_QUERY.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByMultipleQuery = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<>();
            configDto.setCustomTableRowByMultipleQuery(list_customTableRowByMultipleQuery);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_SCHEDULE_DETAIL.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByScheduleDetail = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByScheduleDetail(list_customTableRowByScheduleDetail);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_ORDER_MANAGE.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByOrderManage = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByOrderManage(list_customTableRowByOrderManage);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_APPLY_INFO.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByApplyInfo = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByApplyInfo(list_customTableRowByApplyInfo);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_CLINICSCHE.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customSearchToolByClinicsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<>();
            configDto.setCustomSearchToolByClinicsche(list_customSearchToolByClinicsche);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_CLINICSCHE.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByClinicsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<>();
            configDto.setCustomTableRowByClinicsche(list_customTableRowByClinicsche);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_DEPTSCHE.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customSearchToolByDeptsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<>();
            configDto.setCustomSearchToolByDeptsche(list_customSearchToolByDeptsche);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_DEPTSCHE.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByDeptsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<>();
            configDto.setCustomTableRowByDeptsche(list_customTableRowByDeptsche);
        }
        return configDto;
    }

    private ConfigDto getConfigInfo4SearchesForm(ConfigDto configDto) {
        List<String> paramNameList = new ArrayList<String>();
        // 默认检索栏及表格栏
        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_MULTIPLE_QUERY.getKey());

        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.IS_AUTO_QUERY_BY_SCHEDULE_SIGN.getKey());

        paramNameList.add(ConstantsUtil.ConfigName.AUTO_QUERY_COUNT_BY_SCHEDULE_SIGN.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN_PATIENT_LIST.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_VIRTUAL_ORDER.getKey());
        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_VIRTUAL_ORDER.getKey());

        // 临床端
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_CLINICSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_CLINICSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_DEPTSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE.getKey());
//        paramNameList.add(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE_PATIENT_LIST.getKey());

        DictSysparamsDto dsDto = new DictSysparamsDto();
        dsDto.setParamNameList(paramNameList);
        List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
        if (dictSysparamsList != null && dictSysparamsList.size() > 0) {
            for (DictSysparamsDto param : dictSysparamsList) {
                if (StringUtils.isNotBlank(param.getDataValue())) {
                    param.setParamValue(param.getDataValue());
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcel(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelSortSet(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.YY_PRINT_LIST.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setPrintList(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setPrintListSortSet(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_VIRTUAL_ORDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelByVirtualOrder(JsonUtil.toList(param.getParamValue(), ConfigDto.CustomExcel.class));
                }
                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_VIRTUAL_ORDER.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomExcelSortSetByVirtualOrder(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByScheduleSign(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_MULTIPLE_QUERY.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByMultipleQuery(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
                if (ConstantsUtil.ConfigName.IS_AUTO_QUERY_BY_SCHEDULE_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setIsAutoQueryByScheduleSign(configVal(param.getParamValue(), "1"));
                }
                if (ConstantsUtil.ConfigName.AUTO_QUERY_COUNT_BY_SCHEDULE_SIGN.getKey().equals(param.getParamName())) {
                    configDto.setAutoQueryCountByScheduleSign(StringUtils.isNotBlank(param.getParamValue()) ? Integer.parseInt(param.getParamValue()) : 20);
                }
//                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
//                    configDto.setCustomTableRowSortSetByClinicsche(JsonUtil.json2Bean(param.getParamValue(), ConfigDto.SortSet.class));
//                }
//                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
//                    configDto.setCustomTableRowSortSetByDeptsche(JsonUtil.json2Bean(param.getParamValue(), ConfigDto.SortSet.class));
//                }
                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN_PATIENT_LIST.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
                    configDto.setCustomTableRowSortSetByScheduleSignPatientList(JsonUtil.toBean(param.getParamValue(), ConfigDto.SortSet.class));
                }
//                if (ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE_PATIENT_LIST.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
//                    configDto.setCustomTableRowSortSetByClinicschePatientList(JsonUtil.json2Bean(param.getParamValue(), ConfigDto.SortSet.class));
//                }
//                if (ConstantsUtil.ConfigName.YY_PRINT_LIST_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
//                    configDto.setPrintListByDeptsche(JsonUtil.json2List(param.getParamValue(), ConfigDto.CustomExcel.class));
//                }
//                if (ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
//                    configDto.setPrintListSortSetByDeptsche(JsonUtil.json2Bean(param.getParamValue(), ConfigDto.SortSet.class));
//                }
//                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
//                    configDto.setCustomExcelByDeptsche(JsonUtil.json2List(param.getParamValue(), ConfigDto.CustomExcel.class));
//                }
//                if (ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_DEPTSCHE.getKey().equals(param.getParamName()) && StringUtils.isNotBlank(param.getParamValue())) {
//                    configDto.setCustomExcelSortSetByDeptsche(JsonUtil.json2Bean(param.getParamValue(), ConfigDto.SortSet.class));
//                }
            }
        }
        List<DictSysparamsDto> dictSysparamsDtoList = null;
        DictSysparamsDto dictSysparamsDto = new DictSysparamsDto();
        dictSysparamsDto.setUserId((String) null);
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_SCHEDULE_SIGN.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customSearchToolByScheduleSign = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomSearchToolByScheduleSign(list_customSearchToolByScheduleSign);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_SCHEDULE_SIGN.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByScheduleSign = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByScheduleSign(list_customTableRowByScheduleSign);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_MULTIPLE_QUERY.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customSearchToolByMultipleQuery = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomSearchToolByMultipleQuery(list_customSearchToolByMultipleQuery);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_MULTIPLE_QUERY.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByMultipleQuery = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByMultipleQuery(list_customTableRowByMultipleQuery);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_SCHEDULE_DETAIL.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByScheduleDetail = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByScheduleDetail(list_customTableRowByScheduleDetail);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_ORDER_MANAGE.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByOrderManage = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByOrderManage(list_customTableRowByOrderManage);
        }
        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_APPLY_INFO.getKey());
        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
            if (StringUtils.isBlank(paramValue)) {
                paramValue = dictSysparamsDtoList.get(0).getParamValue();
            }
            List<ConfigDto.CustomExcel> list_customTableRowByApplyInfo = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
            configDto.setCustomTableRowByApplyInfo(list_customTableRowByApplyInfo);
        }
//        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_CLINICSCHE.getKey());
//        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
//        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
//            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
//            if (StringUtils.isBlank(paramValue)) {
//                paramValue = dictSysparamsDtoList.get(0).getParamValue();
//            }
//            List<ConfigDto.CustomExcel> list_customSearchToolByClinicsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.json2List(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
//            configDto.setCustomSearchToolByClinicsche(list_customSearchToolByClinicsche);
//        }
//        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_CLINICSCHE.getKey());
//        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
//        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
//            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
//            if (StringUtils.isBlank(paramValue)) {
//                paramValue = dictSysparamsDtoList.get(0).getParamValue();
//            }
//            List<ConfigDto.CustomExcel> list_customTableRowByClinicsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.json2List(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
//            configDto.setCustomTableRowByClinicsche(list_customTableRowByClinicsche);
//        }
//        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_DEPTSCHE.getKey());
//        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
//        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
//            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
//            if (StringUtils.isBlank(paramValue)) {
//                paramValue = dictSysparamsDtoList.get(0).getParamValue();
//            }
//            List<ConfigDto.CustomExcel> list_customSearchToolByDeptsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.json2List(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
//            configDto.setCustomSearchToolByDeptsche(list_customSearchToolByDeptsche);
//        }
//        dictSysparamsDto.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_DEPTSCHE.getKey());
//        dictSysparamsDtoList = baseMapper.selectSysparmsInfoList(dictSysparamsDto);
//        if (dictSysparamsDtoList != null && !dictSysparamsDtoList.isEmpty()) {
//            String paramValue = dictSysparamsDtoList.get(0).getDataValue();
//            if (StringUtils.isBlank(paramValue)) {
//                paramValue = dictSysparamsDtoList.get(0).getParamValue();
//            }
//            List<ConfigDto.CustomExcel> list_customTableRowByDeptsche = StringUtils.isNotBlank(paramValue) ? JsonUtil.json2List(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<ConfigDto.CustomExcel>();
//            configDto.setCustomTableRowByDeptsche(list_customTableRowByDeptsche);
//        }
        return configDto;
    }

    @Override
    public JsonResult saveConfig(DictSysparamsDto dto) {
        JsonResult jsonResult = new JsonResult();

        String configType = dto.getConfigType();

        // 后端判断【isScanBtnByScheduleSign、isOpenDelApplyBtn】两个字段后将两个值拼接入customConfig，以保证获取配置文件生效
        JSONObject jsonObject = JsonUtil.toJsonObj(dto.getCustomConfig());
        if (dto.getIsScanBtnByScheduleSign() != null && !dto.getIsScanBtnByScheduleSign().isEmpty()) {
            jsonObject.put(ColumnUtil.getFieldName(DictSysparamsDto::getIsScanBtnByScheduleSign), dto.getIsScanBtnByScheduleSign());
            dto.setCustomConfig(jsonObject.toJSONString());
        }
        if (dto.getIsOpenDelApplyBtn() != null && !dto.getIsOpenDelApplyBtn().isEmpty()) {
            jsonObject.put(ColumnUtil.getFieldName(DictSysparamsDto::getIsOpenDelApplyBtn), dto.getIsOpenDelApplyBtn());
            dto.setCustomConfig(jsonObject.toJSONString());
        }

        // 其他类型的配置保存
        if (StringUtils.isNotBlank(dto.getCustomConfig())) {
            jsonResult = saveConfig4Custom(dto);
        }
        // 同步
        if (ConstantsUtil.ConfigType.INFO_SYNC.getKey().equals(configType)) {
            jsonResult = saveConfig4InfoSync(dto);
        }
        // 预约
        else if (ConstantsUtil.ConfigType.SCHEDULE.getKey().equals(configType)) {
            jsonResult = saveConfig4Schedule(dto);
        }
        // 报到配置
        else if (ConstantsUtil.ConfigType.SIGN.getKey().equals(configType)) {
            jsonResult = saveConfig4Sign(dto);
        }
        // 其他配置保存-登录
        else if (ConstantsUtil.ConfigType.OTHER.getKey().equals(configType)) {
            jsonResult = saveConfig4Other(dto);
        }
        // 冲突配置保存
        else if (ConstantsUtil.ConfigType.CONFLICT.getKey().equals(configType)) {
            jsonResult = saveConfig4Conflict(dto);
        }
        // 打印配置
        else if (ConstantsUtil.ConfigType.PRINT.getKey().equals(configType)) {
            // 保存打印相关的配置
            jsonResult = saveConfig4Print(dto);
        } else if (ConstantsUtil.ConfigType.SEARCHES_FORM.getKey().equals(configType)) {
            jsonResult = saveConfig4SearchesForm(dto);
        }
        // 界面配置
        else if (ConstantsUtil.ConfigType.INTERFACE.getKey().equals(configType) || ConstantsUtil.ConfigType.CUSTOM_LIST.getKey().equals(configType)) {
            jsonResult = saveConfig4Interface(dto);
        } else if (!ConstantsUtil.ConfigType.CLINICSCHE.getKey().equals(configType)) {
            jsonResult = JsonResultUtil.failure("系统配置类型无效");
        }
        return jsonResult;
    }

    /**
     * 打印相关配置保存
     *
     * @param dto
     * @return
     */
    private JsonResult saveConfig4Print(DictSysparamsDto dto) {
        if (Objects.nonNull(dto)) {
            List<DictSysparams> sysparamsList = new ArrayList<>();

            // 【点击打印按钮1次，打印多少张】默认为1张
            DictSysparams clickBtnByPrintNum = new DictSysparams();
            clickBtnByPrintNum.setParamName(ConstantsUtil.ConfigName.CLICK_BTN_BY_PRINT_NUM.getKey());
            clickBtnByPrintNum.setMemo("【点击打印按钮1次，打印多少张】默认为1张");
            clickBtnByPrintNum.setParamValue((dto.getClickBtnByPrintNum() != null) ? String.valueOf(dto.getClickBtnByPrintNum()) : "1");
            sysparamsList.add(clickBtnByPrintNum);

            // 预约成功后自动打印条码，1次打印多少张】默认为1张
            DictSysparams autoPrintNumAfterSchedule = new DictSysparams();
            autoPrintNumAfterSchedule.setParamName(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_AFTER_SCHEDULE.getKey());
            autoPrintNumAfterSchedule.setMemo("【预约成功后自动打印条码，1次打印多少张】默认为1张");
            autoPrintNumAfterSchedule.setParamValue((dto.getAutoPrintNumAfterSchedule() != null) ? String.valueOf(dto.getAutoPrintNumAfterSchedule()) : "1");
            sysparamsList.add(autoPrintNumAfterSchedule);

            // 可根据[检查项目]预约成功后自动打印一次性打印多少张
            DictSysparams autoPrintNumByItem = new DictSysparams();
            autoPrintNumByItem.setParamName(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_BY_ITEM.getKey());
            autoPrintNumByItem.setMemo("【可根据[检查项目]预约成功后自动打印一次性打印多少张】");
            autoPrintNumByItem.setParamValue(Objects.isNull(dto.getAutoPrintNumByItem()) ? "" : JsonUtil.toJson(dto.getAutoPrintNumByItem()));
            sysparamsList.add(autoPrintNumByItem);

            // 预约凭条提示报到时间类型
            DictSysparams advanceTimeTypeBySchedulePrint = new DictSysparams();
            advanceTimeTypeBySchedulePrint.setParamName(ConstantsUtil.ConfigName.ADVANCE_TIME_TYPE_BY_SCHEDULE_PRINT.getKey());
            advanceTimeTypeBySchedulePrint.setMemo("【预约凭条提示报到时间类型】0：预约时段的前半区间（包含是否设置最早报到时间），如2017-02-10 08:00前  1：时段范围类，如2017-02-10 08:00~08:30  2：实际可报到时间范围（包含是否设置最晚报到时间），如2017-02-10 08:00~09:00");
            // 如果没有设置默认值为3
            String timeTypeBySchedulePrint = StringUtils.isNotBlank(dto.getAdvanceTimeTypeBySchedulePrint()) ? dto.getAdvanceTimeTypeBySchedulePrint() : "3";
            advanceTimeTypeBySchedulePrint.setParamValue(timeTypeBySchedulePrint);
            sysparamsList.add(advanceTimeTypeBySchedulePrint);

            // 预约成功后，可根据终端类型、检查类别、病人来源提醒是否要打印凭条
            DictSysparams remindPrintTicketAfterSchedule = new DictSysparams();
            remindPrintTicketAfterSchedule.setParamName(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SCHEDULE.getKey());
            remindPrintTicketAfterSchedule.setMemo("【预约成功后，可根据终端类型、检查类别、病人来源提醒是否要打印凭条】printTicketTerminalType：表示预约凭条终端类型；printTicketExamClass：表示预约凭条检查类别；printTicketPatientSource：表示预约凭条病人来源；");
            remindPrintTicketAfterSchedule.setParamValue(JsonUtil.toJson(dto.getRemindPrintTicketAfterSchedule()));
            sysparamsList.add(remindPrintTicketAfterSchedule);

            // 预约成功后，可根据终端类型、检查类别、病人来源自动打印预约凭条
            DictSysparams printTicketAfterSchedule = new DictSysparams();
            printTicketAfterSchedule.setParamName(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SCHEDULE.getKey());
            printTicketAfterSchedule.setMemo("【预约成功后，可根据终端类型、检查类别、病人来源自动打印预约凭条】printTicketTerminalType：表示预约凭条终端类型；printTicketExamClass：表示预约凭条检查类别；printTicketPatientSource：表示预约凭条病人来源；");
            printTicketAfterSchedule.setParamValue(JsonUtil.toJson(dto.getPrintTicketAfterSchedule()));
            sysparamsList.add(printTicketAfterSchedule);

            // 报到凭条设置-报到成功后自动打印凭条
            if (dto.getPrintTicketAfterSign() != null) {
                DictSysparams printTicketAfterSign = new DictSysparams();
                printTicketAfterSign.setParamName(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SIGN.getKey());
                printTicketAfterSign.setMemo("【报到成功后，可根据终端类型、检查类别、病人来源自动打印报到凭条】printTicketTerminalType：表示报到凭条终端类型；printTicketExamClass：表示报到凭条检查类别；printTicketPatientSource：表示报到凭条病人来源；");

                if (dto.getPrintTicketAfterSign() != null && dto.getPrintTicketAfterSign().size() > 0) {
                    printTicketAfterSign.setParamValue(JsonUtil.toJson(dto.getPrintTicketAfterSign()));
                }

                /*if (StringUtils.isNotBlank(dto.getPrintTicketAfterSign())) {
                    List<String> printTicketAfterSignList = (List<String>) CommonUtil.split2List(dto.getPrintTicketAfterSign());
                    if (!printTicketAfterSignList.isEmpty()) {
                        List<ConfigDto.PrintTicketAfterSign> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSign>();
                        for (String printTicket : printTicketAfterSignList) {
                            ConfigDto.PrintTicketAfterSign ticket = new ConfigDto.PrintTicketAfterSign();
                            String[] arr2 = printTicket.split("=");
                            String printTicketTerminalType = (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? arr2[0] : "";
                            List<String> printTicketExamClassList = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? Arrays.asList(arr2[1].split("_")) : new ArrayList<String>();
                            List<String> printTicketPatientSourceList = (StringUtils.isNotBlank(arr2[2]) && !"空".equals(arr2[2])) ? Arrays.asList(arr2[2].split("_")) : new ArrayList<String>();
                            ticket.setPrintTicketTerminalType(printTicketTerminalType);
                            ticket.setPrintTicketExamClass(printTicketExamClassList);
                            ticket.setPrintTicketPatientSource(printTicketPatientSourceList);
                            ticketList.add(ticket);
                        }
                        printTicketAfterSign.setParamValue(JsonUtil.toJson(ticketList));
                    }
                }*/
                sysparamsList.add(printTicketAfterSign);
            }

            // 报到凭条设置-报到成功后是否提醒打印凭条
            if (dto.getRemindPrintTicketAfterSign() != null) {
                DictSysparams remindPrintTicketAfterSign = new DictSysparams();
                remindPrintTicketAfterSign.setParamName(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SIGN.getKey());
                remindPrintTicketAfterSign.setMemo("【报到成功后，可根据终端类型、检查类别、病人来源提醒是否要打印凭条】printTicketTerminalType：表示报到凭条终端类型；printTicketExamClass：表示报到凭条检查类别；printTicketPatientSource：表示报到凭条病人来源；");

                if (dto.getRemindPrintTicketAfterSign() != null && dto.getRemindPrintTicketAfterSign().size() > 0) {
                    remindPrintTicketAfterSign.setParamValue(JsonUtil.toJson(dto.getRemindPrintTicketAfterSign()));
                }

                /*if (StringUtils.isNotBlank(dto.getRemindPrintTicketAfterSign())) {
                    List<String> remindPrintTicketAfterSignList = (List<String>) CommonUtil.split2List(dto.getRemindPrintTicketAfterSign());
                    if (!remindPrintTicketAfterSignList.isEmpty()) {
                        List<ConfigDto.PrintTicketAfterSign> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSign>();
                        for (String remindPrintTicket : remindPrintTicketAfterSignList) {
                            ConfigDto.PrintTicketAfterSign ticket = new ConfigDto.PrintTicketAfterSign();
                            String[] arr2 = remindPrintTicket.split("=");
                            String printTicketTerminalType = (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? arr2[0] : "";
                            List<String> printTicketExamClassList = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? Arrays.asList(arr2[1].split("_")) : new ArrayList<String>();
                            List<String> printTicketPatientSourceList = (StringUtils.isNotBlank(arr2[2]) && !"空".equals(arr2[2])) ? Arrays.asList(arr2[2].split("_")) : new ArrayList<String>();
                            ticket.setPrintTicketTerminalType(printTicketTerminalType);
                            ticket.setPrintTicketExamClass(printTicketExamClassList);
                            ticket.setPrintTicketPatientSource(printTicketPatientSourceList);
                            ticketList.add(ticket);
                        }
                        remindPrintTicketAfterSign.setParamValue(JsonUtil.toJson(ticketList));
                    }
                }*/
                sysparamsList.add(remindPrintTicketAfterSign);
            }

            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    private JsonResult saveConfig4InfoSync(DictSysparamsDto dto) {
        if (dto != null) {
            List<DictSysparams> sysparamsList = new ArrayList<>();
            /* 在综合号码输入号码时增加前缀
            if (dto.getIcCardPres() != null) {
                DictSysparams icCardPres = new DictSysparams();
                icCardPres.setParamName(ConstantsUtil.ConfigName.IC_CARD_PRES.getKey());
                icCardPres.setMemo("【传入的ic卡号加前缀】cardPre：表示卡号前缀，length：表示长度是几位的IcCard值需要加前缀，为空表示不受长度限制，多个长度用英文逗号“,”分隔");
                if (StringUtils.isNotBlank(dto.getIcCardPres())) {
                    List<String> icCardPreList = CommonUtil.split2List(dto.getIcCardPres());
                    if (!icCardPreList.isEmpty()) {
                        List<ConfigDto.IcCardPreScope> cardPreScopeList = new ArrayList<ConfigDto.IcCardPreScope>();
                        for (String icCardPre : icCardPreList) {
                            String[] arr = icCardPre.split("=");
                            boolean isIcCardPreFlag = (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) || (StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1]));
                            if (isIcCardPreFlag) {
                                ConfigDto.IcCardPreScope icCardPreScope = new ConfigDto.IcCardPreScope();
                                icCardPreScope.setCardPre((StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? arr[0] : "");
                                icCardPreScope.setLength((StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) ? arr[1] : "");
                                cardPreScopeList.add(icCardPreScope);
                            }
                        }
                        icCardPres.setParamValue(JsonUtil.toJson(cardPreScopeList));
                    }
                }
                sysparamsList.add(icCardPres);
            }*/
            /* 卡号栏查询支持类型
            if (dto.getIsIcCardInputNewSupport() != null) {
                DictSysparams isIcCardInputNewSupport = new DictSysparams();
                isIcCardInputNewSupport.setParamName(ConstantsUtil.ConfigName.IS_IC_CARD_INPUT_NEW_SUPPORT.getKey());
                isIcCardInputNewSupport.setMemo("【是否启用综合号码新查询支持类型】(1：关闭   0：启用)，domainId：表示支持的卡号类型，值ID参数意思可参考EXAM_APPLY_PATIENT_ID表的[DOMAIN_ID]字段的定义，为空的时候则查询所有值ID");
                if (StringUtils.isNotBlank(dto.getIsIcCardInputNewSupport())) {
                    ConfigDto.IcCardInputNewSupport icCardInputNewSupport = new ConfigDto.IcCardInputNewSupport();
                    icCardInputNewSupport.setGrant(dto.getIsIcCardInputNewSupport());
                    icCardInputNewSupport.setDomainId(CommonUtil.split2List(dto.getDomainId()));
                    isIcCardInputNewSupport.setParamValue(JsonUtil.toJson(icCardInputNewSupport));
                }
                sysparamsList.add(isIcCardInputNewSupport);
            }*/
            if (dto.getIcCardInputSupport() != null) {
                DictSysparams icCardInputSupport = saveConfigInfo(ConstantsUtil.ConfigName.IC_CARD_INPUT_SUPPORT.getKey(),
                        ConstantsUtil.ConfigName.IC_CARD_INPUT_SUPPORT.getValue(),
                        configVal(dto.getIcCardInputSupport(), ""));
                sysparamsList.add(icCardInputSupport);
            }
            if (dto.getIsGetChargeFlagRealTime() != null) {
                DictSysparams isGetChargeFlagRealTime = saveConfigInfo(ConstantsUtil.ConfigName.IS_GET_CHARGE_FLAG_REALTIME.getKey(), "【实时获取缴费单标识】(1：关闭   0：启用)", configVal(dto.getIsGetChargeFlagRealTime(), "1"));
                sysparamsList.add(isGetChargeFlagRealTime);
            }
            if (dto.getIsGetAccountBalanceRealTime() != null) {
                DictSysparams isGetAccountBalanceRealTime = saveConfigInfo(ConstantsUtil.ConfigName.IS_GET_ACCOUNT_BALANCE_REALTIME.getKey(), "【实时获取账户余额及项目金额】(1：关闭   0：启用)", configVal(dto.getIsGetAccountBalanceRealTime(), "1"));
                sysparamsList.add(isGetAccountBalanceRealTime);
            }
            if (dto.getIsGetClinicPathFlagRealTime() != null) {
                DictSysparams isGetClinicPathFlagRealTime = saveConfigInfo(ConstantsUtil.ConfigName.IS_GET_CLINIC_PATH_FLAG_REALTIME.getKey(), "【实时获取临床路径标识】(1：关闭   0：启用)", configVal(dto.getIsGetClinicPathFlagRealTime(), "1"));
                sysparamsList.add(isGetClinicPathFlagRealTime);
            }
            if (dto.getIsNotifyThirdAfterSchedule() != null) {
                DictSysparams isNotifyThirdAfterSchedule = new DictSysparams();
                isNotifyThirdAfterSchedule.setParamName(ConstantsUtil.ConfigName.IS_NOTIFY_THIRD_AFTER_SCHEDULE.getKey());
                isNotifyThirdAfterSchedule.setMemo("【同步给第三方预约信息】(1：关闭   0：启用)，grant：表示是否启用同步给第三方预约信息，isSyncScheduleRealTime：表示是否实时同步预约信息至第三方，isSyncRefer：表示是否同步虚单，syncUrl：表示接口地址，syncInfoSet：表示同步设置相关参数：syncExamClass：同步检查类别，syncAct：同步操作");

                if (dto.getIsNotifyThirdAfterSchedule() != null) {
                    isNotifyThirdAfterSchedule.setParamValue(JsonUtil.toJson(dto.getIsNotifyThirdAfterSchedule()));
                }
                isNotifyThirdAfterSchedule.setParamValue(JsonUtil.toJson(dto.getIsNotifyThirdAfterSchedule()));
//                if (Objects.nonNull(dto.getIsNotifyThirdAfterSchedule())) {
//                    ConfigDto.NotifyThirdAfterSchedule notifyThirdAfterSchedule = new ConfigDto.NotifyThirdAfterSchedule();
//                    notifyThirdAfterSchedule.setGrant(dto.getIsNotifyThirdAfterSchedule().getGrant());
//                    notifyThirdAfterSchedule.setIsSyncRefer(configVal(dto.getIsSyncRefer(), "1"));
//                    notifyThirdAfterSchedule.setIsSyncScheduleRealTime(configVal(dto.getIsSyncScheduleRealTime(), "1"));
//                    notifyThirdAfterSchedule.setSyncUrl(StringUtils.isNotBlank(dto.getSyncUrl()) ? dto.getSyncUrl() : "");
//                    if (StringUtils.isNotBlank(dto.getSyncInfoSets())) {
//                        List<String> syncInfoSetList = CommonUtil.split2List(dto.getSyncInfoSets());
//                        if (!syncInfoSetList.isEmpty()) {
//                            List<ConfigDto.SyncInfoSet> infoSetList = new ArrayList<ConfigDto.SyncInfoSet>();
//                            for (String syncInfoSet : syncInfoSetList) {
//                                String[] arr2 = syncInfoSet.split("=");
//                                ConfigDto.SyncInfoSet infoSet = new ConfigDto.SyncInfoSet();
//                                infoSet.setSyncExamClass((StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? arr2[0] : "");
//                                if (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) {
//                                    List<String> actList = Arrays.asList(arr2[1].split("_"));
//                                    if (!actList.isEmpty()) {
//                                        infoSet.setSyncAct(actList);
//                                    }
//                                }
//                                infoSetList.add(infoSet);
//                            }
//                            notifyThirdAfterSchedule.setSyncInfoSet(infoSetList);
//                        }
//                    }
//                    isNotifyThirdAfterSchedule.setParamValue(JsonUtil.toJson(notifyThirdAfterSchedule));
//                }
                sysparamsList.add(isNotifyThirdAfterSchedule);
            }
            if (dto.getPatientSourceIn() != null) {
                DictSysparams patientSourceIn = saveConfigInfo(ConstantsUtil.ConfigName.PATIENT_SOURCE_IN.getKey(), "【住院病人名称】", configVal(dto.getPatientSourceIn(), "住院"));
                sysparamsList.add(patientSourceIn);
            }
            if (dto.getExamApplyInfoSupport() != null) {
                DictSysparams examApplyInfoSupport = saveConfigInfo(ConstantsUtil.ConfigName.EXAM_APPLY_INFO_SUPPORT.getKey(), "【申请单内容支持修改的内容】(多个用英文逗号“,”分隔)联系电话(phoneNumber)，联系地址(address)，优先级别(priorityOrder)，预约备注(memo)，检查子类(examSubClass)", configVal(dto.getExamApplyInfoSupport(), ""));
                sysparamsList.add(examApplyInfoSupport);
            }
            if (dto.getGetChargeFlagRealTimeUrl() != null) {
                DictSysparams getChargeFlagRealTimeUrl = saveConfigInfo(ConstantsUtil.ConfigName.GET_CHARGE_FLAG_REALTIME_URL.getKey(), "【调用第三方HIS实时获取缴费单标识接口的链接】注：使用的前提是[yy_isGetChargeFlagRealTime]该配置项要启用！", dto.getGetChargeFlagRealTimeUrl());
                sysparamsList.add(getChargeFlagRealTimeUrl);
            }
            if (dto.getGetAccountBalanceRealTimeUrl() != null) {
                DictSysparams getAccountBalanceRealTimeUrl = saveConfigInfo(ConstantsUtil.ConfigName.GET_ACCOUNT_BALANCE_REALTIME_URL.getKey(), "【调用实时获取账户余额及项目金额接口的链接】注：使用的前提是[yy_isGetAccountBalanceRealTime]该配置项要启用！", dto.getGetAccountBalanceRealTimeUrl());
                sysparamsList.add(getAccountBalanceRealTimeUrl);
            }
            if (dto.getIsGetReferPatientInfo() != null) {
                DictSysparams isGetReferPatientInfo = new DictSysparams();
                isGetReferPatientInfo.setParamName(ConstantsUtil.ConfigName.IS_GET_REFER_PATIENT_INFO.getKey());
                isGetReferPatientInfo.setMemo("【是否启用虚单实时获取患者信息】(1：关闭   0：启用)，getReferPatientInfoUrl：虚单实时获取患者信息的链接地址");
                if (StringUtils.isNotBlank(dto.getIsGetReferPatientInfo())) {
                    ConfigDto.GetReferPatientInfo getReferPatientInfo = new ConfigDto.GetReferPatientInfo();
                    getReferPatientInfo.setGrant(dto.getIsGetReferPatientInfo());
                    getReferPatientInfo.setGetReferPatientInfoUrl(dto.getGetReferPatientInfoUrl());
                    isGetReferPatientInfo.setParamValue(JsonUtil.toJson(getReferPatientInfo));
                }
                sysparamsList.add(isGetReferPatientInfo);
            }
            if (dto.getIsVirtualCardReader() != null) {
                DictSysparams isVirtualCardReader = saveConfigInfo(ConstantsUtil.ConfigName.IS_VIRTUAL_CARD_READER.getKey(), "【对卡号进行转换，返回院内能识别的卡号】0：调DLL，1：关闭，2：调第三方接口", configVal(dto.getIsVirtualCardReader(), "1"));
                sysparamsList.add(isVirtualCardReader);
                if (StringUtils.isNotBlank(dto.getIsVirtualCardReader()) && "2".equals(dto.getIsVirtualCardReader()) && dto.getVirtualCardReaderUrl() != null) {
                    DictSysparams virtualCardReaderUrl = saveConfigInfo(ConstantsUtil.ConfigName.VIRTUAL_CARD_READER_URL.getKey(), "【通用患者卡查询接口地址】注：使用的前提是[yy_isVirtualCardReader]该配置项的值等于2", dto.getVirtualCardReaderUrl());
                    sysparamsList.add(virtualCardReaderUrl);
                }
            }
            if (dto.getIsInputNewSupport() != null) {
                DictSysparams isInputNewSupport = new DictSysparams();
                isInputNewSupport.setParamName(ConstantsUtil.ConfigName.IS_INPUT_NEW_SUPPORT.getKey());
                isInputNewSupport.setMemo("【是否启用新查询支持的输入框类型】(1：关闭   0：启用)，inputType：表示支持新查询方式的输入框类型，可提供：ic_card(诊疗卡号)，inpatient_no(住院号)，outpatient_no(门诊号)，apply_no(申请单号)，identity_card(身份证号)，mi_card(医保卡号)，sick_id(病人标识号)");
                if (StringUtils.isNotBlank(dto.getIsInputNewSupport())) {
                    ConfigDto.InputNewSupport inputNewSupport = new ConfigDto.InputNewSupport();
                    inputNewSupport.setGrant(dto.getIsInputNewSupport());
                    inputNewSupport.setInputType(CommonUtil.split2List(dto.getInputType()));
                    isInputNewSupport.setParamValue(JsonUtil.toJson(inputNewSupport));
                }
                sysparamsList.add(isInputNewSupport);
            }
            if (dto.getIsUpperCaseInput() != null) {
                DictSysparams isUpperCaseInput = saveConfigInfo(ConstantsUtil.ConfigName.IS_UPPER_CASE_INPUT.getKey(), "【卡号栏输入字母转化为大写进行查询】(1：关闭   0：启用)", configVal(dto.getIsUpperCaseInput(), "1"));
                sysparamsList.add(isUpperCaseInput);
            }
            DictSysparams httpTimeout = saveConfigInfo(ConstantsUtil.ConfigName.HTTP_TIMEOUT.getKey(), "【接口超时断连时间】只填数值（单位：秒）", (dto.getHttpTimeOut() != null) ? String.valueOf(dto.getHttpTimeOut()) : "");
            sysparamsList.add(httpTimeout);
            if (dto.getIsTokenOauthByClinic() != null) {
                DictSysparams isTokenOauthByClinic = saveConfigInfo(ConstantsUtil.ConfigName.IS_TOKEN_OAUTH_BY_CLINIC.getKey(), "【启用临床调用时经过token验证】(1：关闭   0：启用)", configVal(dto.getIsTokenOauthByClinic(), "1"));
                sysparamsList.add(isTokenOauthByClinic);
            }
            if (dto.getOpenThirdUrl() != null) {
                DictSysparams openThirdUrl = saveConfigInfo(ConstantsUtil.ConfigName.OPEN_THIRD_URL.getKey(), "【调用第三方界面（预约报到界面）】location：按钮所在位置，name：按钮名称，url：第三方链接地址，terminalType：终端类型，interfaceUrl：第三方接口地址", JsonUtil.toJson(dto.getOpenThirdUrl()));
                sysparamsList.add(openThirdUrl);
            }
            if (dto.getIsMessageAlert() != null) {
                DictSysparams isMessageAlert = saveConfigInfo(ConstantsUtil.ConfigName.IS_MESSAGE_ALERT.getKey(), "【启用消息提醒(一级消息logo)】(1：关闭   0：启用)", configVal(dto.getIsMessageAlert(), "1"));
                sysparamsList.add(isMessageAlert);
            }
            if (dto.getIsMessageAlertByWard() != null) {
                DictSysparams isMessageAlertByWard = saveConfigInfo(ConstantsUtil.ConfigName.IS_MESSAGE_ALERT_BY_WARD.getKey(), "【启用住院患者的申请单在修改预约与取消预约时，给申请单病区所关联的科室的用户发送消息提醒(二级提示内容)】(1：关闭   0：启用)", configVal(dto.getIsMessageAlertByWard(), "1"));
                sysparamsList.add(isMessageAlertByWard);
            }
            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    private JsonResult saveConfig4Schedule(DictSysparamsDto dto) {
        if (dto != null) {
            List<DictSysparams> sysparamsList = new ArrayList<>();
            if (dto.getIsDeptWardDefaultByTerminalType() != null) {
                DictSysparams isDeptWardDefaultByTerminalType = new DictSysparams();
                isDeptWardDefaultByTerminalType.setParamName(ConstantsUtil.ConfigName.IS_DEPT_WARD_DEFAULT_BY_TERMINAL_TYPE.getKey());
                isDeptWardDefaultByTerminalType.setMemo("【根据终端，默认申请科室及病区】(1：关闭   0：启用)，terminalType：终端类型，暂支持A-医技预约  B-临床预约  E-预约中心");
                if (StringUtils.isNotBlank(dto.getIsDeptWardDefaultByTerminalType())) {
                    ConfigDto.DeptWardDefaultByTerminalType deptWardDefaultByTerminalType = new ConfigDto.DeptWardDefaultByTerminalType();
                    deptWardDefaultByTerminalType.setGrant(dto.getIsDeptWardDefaultByTerminalType());
                    if (StringUtils.isNotBlank(dto.getDefaultTerminalType())) {
                        deptWardDefaultByTerminalType.setTerminalType(CommonUtil.split2List(dto.getDefaultTerminalType()));
                    }
                    isDeptWardDefaultByTerminalType.setParamValue(JsonUtil.toJson(deptWardDefaultByTerminalType));
                }
                sysparamsList.add(isDeptWardDefaultByTerminalType);
            }
            if (dto.getIsEditDeptWardLimit() != null) {
                DictSysparams isEditDeptWardLimit = new DictSysparams();
                isEditDeptWardLimit.setParamName(ConstantsUtil.ConfigName.IS_EDIT_DEPT_WARD_LIMIT.getKey());
                isEditDeptWardLimit.setMemo("【默认科室开启后，限制更改科室及病区】(1：关闭   0：启用)");
                isEditDeptWardLimit.setParamValue(configVal(dto.getIsEditDeptWardLimit(), "1"));
                sysparamsList.add(isEditDeptWardLimit);
            }
            DictSysparams reqDateDefaultBySchedule = new DictSysparams();
            reqDateDefaultBySchedule.setParamName(ConstantsUtil.ConfigName.REQ_DATE_DEFAULT_BY_SCHEDULE.getKey());
            reqDateDefaultBySchedule.setMemo("【默认查询天数】（检查预约和绿色通道）");
            reqDateDefaultBySchedule.setParamValue((dto.getReqDateDefaultBySchedule() != null) ? String.valueOf(dto.getReqDateDefaultBySchedule()) : "");
            sysparamsList.add(reqDateDefaultBySchedule);
            DictSysparams reqDateDefaultByQuery = new DictSysparams();
            reqDateDefaultByQuery.setParamName(ConstantsUtil.ConfigName.REQ_DATE_DEFAULT_BY_QUERY.getKey());
            reqDateDefaultByQuery.setMemo("【默认查询天数】（综合查询）");
            reqDateDefaultByQuery.setParamValue((dto.getReqDateDefaultByQuery() != null) ? String.valueOf(dto.getReqDateDefaultByQuery()) : "");
            sysparamsList.add(reqDateDefaultByQuery);
            if (dto.getNotExamClass() != null) {
                DictSysparams notExamClass = new DictSysparams();
                notExamClass.setParamName(ConstantsUtil.ConfigName.NOT_EXAM_CLASS.getKey());
                notExamClass.setMemo("【不预约的检查类别】(多个用英文逗号“,”分隔)");
                notExamClass.setParamValue(dto.getNotExamClass());
                sysparamsList.add(notExamClass);
            }
            if (dto.getIsShowChargeFlag() != null) {
                DictSysparams isShowChargeFlag = new DictSysparams();
                isShowChargeFlag.setParamName(ConstantsUtil.ConfigName.IS_SHOW_CHARGE_FLAG.getKey());
                isShowChargeFlag.setMemo("【显示缴费状态】(1：关闭   0：启用)");
                isShowChargeFlag.setParamValue(configVal(dto.getIsShowChargeFlag(), "1"));
                sysparamsList.add(isShowChargeFlag);
            }
            if (dto.getChargeAfterExamClass() != null) {
                DictSysparams chargeAfterExamClass = new DictSysparams();
                chargeAfterExamClass.setParamName(ConstantsUtil.ConfigName.CHARGE_AFTER_EXAM_CLASS.getKey());
                chargeAfterExamClass.setMemo("【预约成功后执行扣费的类别】(多个用英文逗号“,”分隔)");
                chargeAfterExamClass.setParamValue(dto.getChargeAfterExamClass());
                sysparamsList.add(chargeAfterExamClass);
            }
            if (dto.getChargeFirstExamClass() != null) {
                DictSysparams chargeFirstExamClass = new DictSysparams();
                chargeFirstExamClass.setParamName(ConstantsUtil.ConfigName.CHARGE_FIRST_EXAM_CLASS.getKey());
                chargeFirstExamClass.setMemo("【限制先缴费后预约的检查类别】(多个用英文逗号“,”分隔)");
                chargeFirstExamClass.setParamValue(dto.getChargeFirstExamClass());
                sysparamsList.add(chargeFirstExamClass);
            }
            if (dto.getChargeFirstPatientSource() != null) {
                DictSysparams chargeFirstPatientSource = new DictSysparams();
                chargeFirstPatientSource.setParamName(ConstantsUtil.ConfigName.CHARGE_FIRST_PATIENT_SOURCE.getKey());
                chargeFirstPatientSource.setMemo("【限制先缴费后预约的病人来源】(多个用英文逗号“,”分隔)");
                chargeFirstPatientSource.setParamValue(dto.getChargeFirstPatientSource());
                sysparamsList.add(chargeFirstPatientSource);
            }
            DictSysparams cancelScheduleNoChargeMin = new DictSysparams();
            cancelScheduleNoChargeMin.setParamName(ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE_MIN.getKey());
            cancelScheduleNoChargeMin.setMemo("【取消未缴费的预约的时间间隔】(单位:分钟)");
            cancelScheduleNoChargeMin.setParamValue((dto.getCancelScheduleNoChargeMin() != null) ? String.valueOf(dto.getCancelScheduleNoChargeMin()) : "");
            sysparamsList.add(cancelScheduleNoChargeMin);
            if (dto.getCancelScheduleNoCharge() != null) {
                DictSysparams cancelScheduleNoCharge = new DictSysparams();
                cancelScheduleNoCharge.setParamName(ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE.getKey());
                cancelScheduleNoCharge.setMemo("【取消非住院未缴费的预约==>取消未缴费的预约】(单位：分钟),examClass:检查类别,cancelMin:取消时间间隔(单位：分钟),patientSource:病人来源");

                if (dto.getCancelScheduleNoCharge() != null && dto.getCancelScheduleNoCharge().size() > 0) {
                    cancelScheduleNoCharge.setParamValue(JsonUtil.toJson(dto.getCancelScheduleNoCharge()));
                }

                /*if (StringUtils.isNotBlank(dto.getIsCancelScheduleNoCharge())) {
                    List<String> cancelScheduleList = (List<String>) CommonUtil.split2List(dto.getIsCancelScheduleNoCharge());
                    if (!cancelScheduleList.isEmpty()) {
                        List<ConfigDto.CancelScheduleNoCharge> noChargeList = new ArrayList<ConfigDto.CancelScheduleNoCharge>();
                        for (String cancelScheduleStr : cancelScheduleList) {
                            ConfigDto.CancelScheduleNoCharge cancelScheduleNoCharge = new ConfigDto.CancelScheduleNoCharge();
                            String[] arr = cancelScheduleStr.split("=");
                            List<String> examClassList = (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? Arrays.asList(arr[0].split("_")) : new ArrayList<String>();
                            Integer cancelMin = StringUtils.isNotBlank(arr[1]) ? Integer.valueOf(Integer.parseInt(arr[1])) : null;
                            List<String> patientSourceList = (StringUtils.isNotBlank(arr[2]) && !"空".equals(arr[2])) ? Arrays.asList(arr[2].split("_")) : new ArrayList<String>();
                            cancelScheduleNoCharge.setExamClass(examClassList);
                            cancelScheduleNoCharge.setCancelMin(cancelMin);
                            cancelScheduleNoCharge.setPatientSource(patientSourceList);
                            noChargeList.add(cancelScheduleNoCharge);
                        }
                        isCancelScheduleNoCharge.setParamValue(JsonUtil.toJson(noChargeList));
                    }
                }*/
                sysparamsList.add(cancelScheduleNoCharge);
            }
            if (dto.getOrganExamClass() != null) {
                DictSysparams organExamClass = new DictSysparams();
                organExamClass.setParamName(ConstantsUtil.ConfigName.ORGAN_EXAM_CLASS.getKey());
                organExamClass.setMemo("【按项目预约量系数占号的检查类别】(多个用英文逗号“,”分隔)");
                organExamClass.setParamValue(dto.getOrganExamClass());
                sysparamsList.add(organExamClass);
            }
            if (dto.getSpanHospitalExamClass() != null) {
                DictSysparams spanHospitalExamClass = new DictSysparams();
                spanHospitalExamClass.setParamName(ConstantsUtil.ConfigName.SPAN_HOSPITAL_EXAM_CLASS.getKey());
                spanHospitalExamClass.setMemo("【启用跨院区预约的检查类别】(多个用英文逗号“,”分隔)");
                spanHospitalExamClass.setParamValue(dto.getSpanHospitalExamClass());
                sysparamsList.add(spanHospitalExamClass);
            }
            if (dto.getIsAutoScheduleDelayTime() != null) {
                DictSysparams isAutoScheduleDelayTime = new DictSysparams();
                isAutoScheduleDelayTime.setParamName(ConstantsUtil.ConfigName.AUTO_SCHEDULE_DELAY_TIME.getKey());
                isAutoScheduleDelayTime.setMemo("【自动预约延缓时长】(1：关闭   0：启用)，patientSource：表示病人来源，delayTime：表示延缓时长（单位：分钟）");
                if (StringUtils.isNotBlank(dto.getIsAutoScheduleDelayTime())) {
                    ConfigDto.AutoScheduleDelayTime autoScheduleDelayTime = new ConfigDto.AutoScheduleDelayTime();
                    autoScheduleDelayTime.setGrant(dto.getIsAutoScheduleDelayTime());
                    if (StringUtils.isNotBlank(dto.getAutoSchedulePatientSource())) {
                        autoScheduleDelayTime.setPatientSource(CommonUtil.split2List(dto.getAutoSchedulePatientSource()));
                    }
                    autoScheduleDelayTime.setDelayTime(dto.getAutoScheduleDelayTime());
                    isAutoScheduleDelayTime.setParamValue(JsonUtil.toJson(autoScheduleDelayTime));
                }
                sysparamsList.add(isAutoScheduleDelayTime);
            }
            if (dto.getIsValidDate() != null) {
                DictSysparams isValidDate = new DictSysparams();
                isValidDate.setParamName(ConstantsUtil.ConfigName.IS_VALID_DATE.getKey());
                isValidDate.setMemo("【过滤历史申请单时间点】(1：关闭   0：启用)，validDate：表示历史申请单时间（格式：yyyy-MM-dd）");
                if (StringUtils.isNotBlank(dto.getIsValidDate())) {
                    ConfigDto.ValidDate validDate = new ConfigDto.ValidDate();
                    validDate.setGrant(dto.getIsValidDate());
                    if (StringUtils.isNotBlank(dto.getValidDate())) {
                        validDate.setValidDate(dto.getValidDate());
                    }
                    isValidDate.setParamValue(JsonUtil.toJson(validDate));
                }
                sysparamsList.add(isValidDate);
            }
            if (dto.getIsCancelFlag() != null) {
                DictSysparams isCancelFlag = new DictSysparams();
                isCancelFlag.setParamName(ConstantsUtil.ConfigName.IS_CANCEL_FLAG.getKey());
                isCancelFlag.setMemo("【“已取消”预约状态】(1：关闭   0：启用)，注：对“未预约”申请单细分为“已取消”，且该预约状态的申请单不推荐预约时间");
                isCancelFlag.setParamValue(configVal(dto.getIsCancelFlag(), "1"));
                sysparamsList.add(isCancelFlag);
            }
            if (dto.getIsSchedulePlanByDeptsche() != null) {
                DictSysparams isSchedulePlanByDeptsche = new DictSysparams();
                isSchedulePlanByDeptsche.setParamName(ConstantsUtil.ConfigName.IS_SCHEDULE_PLAN_BY_DEPTSCHE.getKey());
                isSchedulePlanByDeptsche.setMemo("【医技预约的预约计划】0：关闭,1：推荐最早,2：推荐同天");
                isSchedulePlanByDeptsche.setParamValue(configVal(dto.getIsSchedulePlanByDeptsche(), "0"));
                sysparamsList.add(isSchedulePlanByDeptsche);
            }
            if (dto.getIsSchedulePlanByClinic() != null) {
                DictSysparams isSchedulePlanByClinic = new DictSysparams();
                isSchedulePlanByClinic.setParamName(ConstantsUtil.ConfigName.IS_SCHEDULE_PLAN_BY_CLINIC.getKey());
                isSchedulePlanByClinic.setMemo("【临床预约的预约计划】0：关闭,1：推荐最早,2：推荐同天");
                isSchedulePlanByClinic.setParamValue(configVal(dto.getIsSchedulePlanByClinic(), "0"));
                sysparamsList.add(isSchedulePlanByClinic);
            }
            if (dto.getIsScheduleQueryToClinic() != null) {
                DictSysparams isScheduleQueryToClinic = new DictSysparams();
                isScheduleQueryToClinic.setParamName(ConstantsUtil.ConfigName.IS_SCHEDULE_QUERY_TO_CLINIC.getKey());
                isScheduleQueryToClinic.setMemo("【预约查询界面，申请单跳转到临床预约界面】(1：关闭   0：启用)");
                isScheduleQueryToClinic.setParamValue(configVal(dto.getIsScheduleQueryToClinic(), "1"));
                sysparamsList.add(isScheduleQueryToClinic);
            }
            if (dto.getIsShowNotice() != null) {
                DictSysparams isShowNotice = new DictSysparams();
                isShowNotice.setParamName(ConstantsUtil.ConfigName.IS_SHOW_NOTICE.getKey());
                isShowNotice.setMemo("【在查询列表显示注意事项】(1：关闭   0：启用)");
                isShowNotice.setParamValue(configVal(dto.getIsShowNotice(), "1"));
                sysparamsList.add(isShowNotice);
            }
            if (dto.getSelfReqDateLimit() != null) {
                DictSysparams selfReqDateLimit = new DictSysparams();
                selfReqDateLimit.setParamName(ConstantsUtil.ConfigName.SELF_REQ_DATE_LIMIT.getKey());
                selfReqDateLimit.setMemo("【开单时间超过限制天数的申请单无法预约】examClass：表示限制天数的检查类别，expireDay：表示限制预约天数，terminalType：表示限制天数的终端类型");

                if (dto.getSelfReqDateLimit() != null && dto.getSelfReqDateLimit().size() > 0) {
                    selfReqDateLimit.setParamValue(JsonUtil.toJson(dto.getSelfReqDateLimit()));
                }

                /*if (StringUtils.isNotBlank(dto.getSelfReqDateLimit())) {
                    List<String> limitExamClassList = (List<String>) CommonUtil.split2List(dto.getSelfReqDateLimit());
                    if (!limitExamClassList.isEmpty()) {
                        List<ConfigDto.SelfReqDateLimit> selfReqDateLimitList = new ArrayList<ConfigDto.SelfReqDateLimit>();
                        for (String limitVal : limitExamClassList) {
                            String[] arr2 = limitVal.split("=");
                            if (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0]) && StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) {
                                ConfigDto.SelfReqDateLimit selfLimit = new ConfigDto.SelfReqDateLimit();
                                List<String> classList = (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? Arrays.asList(arr2[0].split("_")) : new ArrayList<String>();
                                int expireDay = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? Integer.parseInt(arr2[1]) : 0;
                                List<String> terminalTypeList = (StringUtils.isNotBlank(arr2[2]) && !"空".equals(arr2[2])) ? Arrays.asList(arr2[2].split("_")) : new ArrayList<String>();
                                selfLimit.setExamClass(classList);
                                selfLimit.setExpireDay(Integer.valueOf(expireDay));
                                selfLimit.setTerminalType(terminalTypeList);
                                selfReqDateLimitList.add(selfLimit);
                            }
                        }
                        selfReqDateLimit.setParamValue(JsonUtil.toJson(selfReqDateLimitList));
                    }
                }*/
                sysparamsList.add(selfReqDateLimit);
            }
            if (dto.getIsRecordNotesByCancel() != null) {
                DictSysparams isRecordNotesByCancel = new DictSysparams();
                isRecordNotesByCancel.setParamName(ConstantsUtil.ConfigName.IS_RECORD_NOTES_BY_CANCEL.getKey());
                isRecordNotesByCancel.setMemo("【“取消预约”需录入备注说明】(1：关闭   0：启用)");
                isRecordNotesByCancel.setParamValue(configVal(dto.getIsRecordNotesByCancel(), "1"));
                sysparamsList.add(isRecordNotesByCancel);
            }
            if (dto.getExpireDayByPatientSource() != null) {
                DictSysparams expireDayByPatientSource = new DictSysparams();
                expireDayByPatientSource.setParamName(ConstantsUtil.ConfigName.EXPIRE_DAY_BY_PATIENT_SOURCE.getKey());
                expireDayByPatientSource.setMemo("【按病人来源开放预约天数限制】(1：关闭   0：启用)，patientSource：表示病人来源；expireDay：表示开放预约天数限制，单位为天，空值时不受限制；[注：当“预约管理》预约队列”的开放预约天数没有配置时，才会使用到这里的开放预约天数的配置]");

                if (dto.getExpireDayByPatientSource() != null) {
                    List<ConfigDto.ExpireDayByPatientSource> expireDayList = new ArrayList<ConfigDto.ExpireDayByPatientSource>();
                    ConfigDto.ExpireDayByPatientSource expireDay2 = new ConfigDto.ExpireDayByPatientSource();
                    dto.getExpireDayByPatientSource().forEach(vo -> {
                        expireDay2.setPatientSource(StringUtils.isNotBlank(vo.getPatientSource()) ? vo.getPatientSource() : "");
                        expireDay2.setExpireDay(vo.getExpireDay() != null ? vo.getExpireDay() : null);
                        expireDayList.add(expireDay2);
                    });
                    expireDayByPatientSource.setParamValue(JsonUtil.toJson(expireDayList));
                }

                /*if (StringUtils.isNotBlank(dto.getExpireDayByPatientSource())) {
                    List<String> patientSourceList2 = (List<String>) CommonUtil.split2List(dto.getExpireDayByPatientSource());
                    if (!patientSourceList2.isEmpty()) {
                        List<ConfigDto.ExpireDayByPatientSource> expireDayList = new ArrayList<ConfigDto.ExpireDayByPatientSource>();
                        for (String patientSource : patientSourceList2) {
                            ConfigDto.ExpireDayByPatientSource expireDay2 = new ConfigDto.ExpireDayByPatientSource();
                            String[] arr = patientSource.split("=");
                            for (int i = 0; i < arr.length; ++i) {
                                if (arr[i] != null && ("null").equals(arr[i])) {
                                    arr[i] = null;
                                }
                            }
                            expireDay2.setPatientSource(StringUtils.isNotBlank(arr[0]) ? arr[0] : "");
                            expireDay2.setExpireDay((StringUtils.isNotBlank(arr[1]) && StringUtils.isNumeric(arr[1])) ? Integer.valueOf(Integer.parseInt(arr[1])) : null);
                            expireDayList.add(expireDay2);
                        }
                        expireDayByPatientSource.setParamValue(JsonUtil.toJson(expireDayList));
                    }
                }*/
                sysparamsList.add(expireDayByPatientSource);
            }
            if (dto.getTransTool() != null) {
                DictSysparams transTool = new DictSysparams();
                transTool.setParamName(ConstantsUtil.ConfigName.TRANS_TOOL.getKey());
                transTool.setMemo("【运送工具类型】(多个用英文逗号“,”分隔)");
                transTool.setParamValue(dto.getTransTool());
                sysparamsList.add(transTool);
            }
            if (dto.getIsRecedeCostByCancel() != null) {
                DictSysparams isRecedeCostByCancel = new DictSysparams();
                isRecedeCostByCancel.setParamName(ConstantsUtil.ConfigName.IS_RECEDE_COST_BY_CANCEL.getKey());
                isRecedeCostByCancel.setMemo("【是否启用取消预约调用退费接口】(1：关闭   0：启用)，recedeCostUrl：表示第三方退费接口的链接地址");
                if (StringUtils.isNotBlank(dto.getIsRecedeCostByCancel())) {
                    ConfigDto.RecedeCostByCancel recedeCostByCancel = new ConfigDto.RecedeCostByCancel();
                    recedeCostByCancel.setGrant(dto.getIsRecedeCostByCancel());
                    recedeCostByCancel.setRecedeCostUrl(dto.getRecedeCostUrlByCancel());
                    isRecedeCostByCancel.setParamValue(JsonUtil.toJson(recedeCostByCancel));
                }
                sysparamsList.add(isRecedeCostByCancel);
            }
            if (dto.getChargeAfterScheduleUrl() != null) {
                DictSysparams chargeAfterScheduleUrl = new DictSysparams();
                chargeAfterScheduleUrl.setParamName(ConstantsUtil.ConfigName.CHARGE_AFTER_SCHEDULE_URL.getKey());
                chargeAfterScheduleUrl.setMemo("【预约后执行扣费接口链接】注：使用的前提是[yy_chargeAfterExamClass]该配置项已配置了检查类别！");
                chargeAfterScheduleUrl.setParamValue(dto.getChargeAfterScheduleUrl());
                sysparamsList.add(chargeAfterScheduleUrl);
            }
            if (dto.getChargeFirstScheduleUrl() != null) {
                DictSysparams chargeFirstScheduleUrl = new DictSysparams();
                chargeFirstScheduleUrl.setParamName(ConstantsUtil.ConfigName.CHARGE_FIRST_SCHEDULE_URL.getKey());
                chargeFirstScheduleUrl.setMemo("【限制先缴费后预约接口链接】注：使用的前提是[yy_chargeFirstExamClass]或[yy_chargeFirstPatientSource]或[yy_chargeFirstTerminalType]配置项已设置参数！");
                chargeFirstScheduleUrl.setParamValue(dto.getChargeFirstScheduleUrl());
                sysparamsList.add(chargeFirstScheduleUrl);
            }
            if (dto.getMergeItem() != null) {
                DictSysparams mergeItem = new DictSysparams();
                mergeItem.setParamName(ConstantsUtil.ConfigName.MERGE_ITEM.getKey());
                mergeItem.setMemo("【允许申请单根据检查类别和限制天数进行合单】examClass：表示要合并申请单的检查类别；mergeDateTime：表示合并申请单天数限制（默认时间单位为天）；");

                for (ConfigDto.MergeItem item : dto.getMergeItem()) {
                    if (StringUtils.isBlank(item.getMergeDateTime())) {
                        item.setMergeDateTime(String.valueOf(item.getMergeDateLimit()));
                    }
                }

                if (dto.getMergeItem() != null && dto.getMergeItem().size() > 0) {
                    mergeItem.setParamValue(JsonUtil.toJson(dto.getMergeItem()));
                }

                /*if (StringUtils.isNotBlank(dto.getMergeItem())) {
                    List<String> mergeItemList = (List<String>) CommonUtil.split2List(dto.getMergeItem());
                    if (!mergeItemList.isEmpty()) {
                        List<ConfigDto.MergeItem> mergeList = new ArrayList<ConfigDto.MergeItem>();
                        for (String mergeItemStr : mergeItemList) {
                            ConfigDto.MergeItem merge = new ConfigDto.MergeItem();
                            String[] arr = mergeItemStr.split("=");
                            List<String> examClassList = StringUtils.isNotBlank(arr[0]) ? Arrays.asList(arr[0].split("_")) : new ArrayList<String>();
                            merge.setExamClass(examClassList);
                            String mergeDateTime = "";
                            if (StringUtils.isNotBlank(arr[1])) {
                                mergeDateTime = arr[1];
                                if (mergeDateTime.endsWith("天")) {
                                    mergeDateTime = mergeDateTime.substring(0, mergeDateTime.lastIndexOf("天"));
                                }
                            }
                            merge.setMergeDateTime(mergeDateTime);
                            mergeList.add(merge);
                        }
                        mergeItem.setParamValue(JsonUtil.toJson(mergeList));
                    }
                }*/
                sysparamsList.add(mergeItem);
            }
            if (dto.getNoFreeSourceByCancel() != null) {
                DictSysparams noFreeSourceByCancel = new DictSysparams();
                noFreeSourceByCancel.setParamName(ConstantsUtil.ConfigName.NO_FREE_SOURCE_BY_CANCEL.getKey());
                noFreeSourceByCancel.setMemo("【取消预约号源不释放】examClass：表示提前报到释放号源的检查类别；leadTime：表示提前时间（界面选什么，就怎样去存进数据库）；");

                if (dto.getNoFreeSourceByCancel() != null && dto.getNoFreeSourceByCancel().size() > 0) {
                    noFreeSourceByCancel.setParamValue(JsonUtil.toJson(dto.getNoFreeSourceByCancel()));
                }

                /*if (StringUtils.isNotBlank(dto.getNoFreeSourceByCancel())) {
                    List<String> noFreeSourceByCancelList = (List<String>) CommonUtil.split2List(dto.getNoFreeSourceByCancel());
                    if (!noFreeSourceByCancelList.isEmpty()) {
                        List<ConfigDto.NoFreeSourceByCancel> noFreeSourceList = new ArrayList<ConfigDto.NoFreeSourceByCancel>();
                        for (String noFreeSourceByCancelStr : noFreeSourceByCancelList) {
                            ConfigDto.NoFreeSourceByCancel noFreeSource = new ConfigDto.NoFreeSourceByCancel();
                            String[] arr = noFreeSourceByCancelStr.split("=");
                            List<String> examClassList = StringUtils.isNotBlank(arr[0]) ? Arrays.asList(arr[0].split("_")) : new ArrayList<String>();
                            noFreeSource.setExamClass(examClassList);
                            noFreeSource.setLeadTime(StringUtils.isNotBlank(arr[1]) ? arr[1] : "");
                            noFreeSourceList.add(noFreeSource);
                        }
                        noFreeSourceByCancel.setParamValue(JsonUtil.toJson(noFreeSourceList));
                    }
                }*/
                sysparamsList.add(noFreeSourceByCancel);
            }
            if (dto.getNoShowUnScheduleItemByTerminalType() != null) {
                DictSysparams noShowUnScheduleItemByTerminalType = new DictSysparams();
                noShowUnScheduleItemByTerminalType.setParamName(ConstantsUtil.ConfigName.NO_SHOW_UN_SCHEDULE_ITEM_BY_TERMINAL_TYPE.getKey());
                noShowUnScheduleItemByTerminalType.setMemo("【不显示不预约检查项目的终端类型】(多个用英文逗号“,”分隔)");
                noShowUnScheduleItemByTerminalType.setParamValue(dto.getNoShowUnScheduleItemByTerminalType());
                sysparamsList.add(noShowUnScheduleItemByTerminalType);
            }
            if (dto.getIsSpanHospitalExamClassByGreenChannel() != null) {
                DictSysparams isSpanHospitalExamClassByGreenChannel = new DictSysparams();
                isSpanHospitalExamClassByGreenChannel.setParamName(ConstantsUtil.ConfigName.IS_SPAN_HOSPITAL_EXAM_CLASS_BY_GREEN_CHANNEL.getKey());
                isSpanHospitalExamClassByGreenChannel.setMemo("【启用绿色通道在同类别下可跨院区预约】(1：关闭   0：启用)");
                isSpanHospitalExamClassByGreenChannel.setParamValue(configVal(dto.getIsSpanHospitalExamClassByGreenChannel(), "1"));
                sysparamsList.add(isSpanHospitalExamClassByGreenChannel);
            }
            if (dto.getCheckOutPhoneNumberByExamClass() != null) {
                DictSysparams checkOutPhoneNumberByExamClass = new DictSysparams();
                checkOutPhoneNumberByExamClass.setParamName(ConstantsUtil.ConfigName.CHECKOUT_PHONE_NUMBER_BY_EXAM_CLASS.getKey());
                checkOutPhoneNumberByExamClass.setMemo("【根据检查类别，申请单的电话号码是否为必填】(多个用英文逗号“,”分隔)");
                checkOutPhoneNumberByExamClass.setParamValue(dto.getCheckOutPhoneNumberByExamClass());
                sysparamsList.add(checkOutPhoneNumberByExamClass);
            }
            if (dto.getIsShowApplyNumber() != null) {
                DictSysparams isShowApplyNumber = new DictSysparams();
                isShowApplyNumber.setParamName(ConstantsUtil.ConfigName.IS_SHOW_APPLY_NUMBER.getKey());
                isShowApplyNumber.setMemo("【是否显示申请单数量】(1：不显示   0：显示)");
                isShowApplyNumber.setParamValue(configVal(dto.getIsShowApplyNumber(), "1"));
                sysparamsList.add(isShowApplyNumber);
            }
            if (dto.getCancelScheduleNoChargeByTime() != null) {
                DictSysparams cancelScheduleNoChargeByTime = new DictSysparams();
                cancelScheduleNoChargeByTime.setParamName(ConstantsUtil.ConfigName.CANCEL_SCHEDULE_NO_CHARGE_BY_TIME.getKey());
                cancelScheduleNoChargeByTime.setMemo("【取消非住院未缴费的预约==>取消未缴费的预约】(按时间点),examClass:检查类别,cancelTime:取消时间点(格式：时分),patientSource:病人来源");

                if (dto.getCancelScheduleNoChargeByTime() != null && dto.getCancelScheduleNoChargeByTime().size() > 0) {
                    cancelScheduleNoChargeByTime.setParamValue(JsonUtil.toJson(dto.getCancelScheduleNoChargeByTime()));
                }

                /*if (StringUtils.isNotBlank(dto.getCancelScheduleNoChargeByTime())) {
                    List<String> cancelScheduleByTimeList = (List<String>) CommonUtil.split2List(dto.getCancelScheduleNoChargeByTime());
                    if (!cancelScheduleByTimeList.isEmpty()) {
                        List<ConfigDto.CancelScheduleNoCharge> noChargeByTimeList = new ArrayList<ConfigDto.CancelScheduleNoCharge>();
                        for (String cancelScheduleByTime : cancelScheduleByTimeList) {
                            ConfigDto.CancelScheduleNoCharge cancelScheduleNoCharge = new ConfigDto.CancelScheduleNoCharge();
                            String[] arr = cancelScheduleByTime.split("=");
                            List<String> examClassList = (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? Arrays.asList(arr[0].split("_")) : new ArrayList<String>();
                            String cancelTime = StringUtils.isNotBlank(arr[1]) ? arr[1] : "";
                            List<String> patientSourceList = (StringUtils.isNotBlank(arr[2]) && !"空".equals(arr[2])) ? Arrays.asList(arr[2].split("_")) : new ArrayList<String>();
                            cancelScheduleNoCharge.setExamClass(examClassList);
                            cancelScheduleNoCharge.setCancelTime(cancelTime);
                            cancelScheduleNoCharge.setPatientSource(patientSourceList);
                            noChargeByTimeList.add(cancelScheduleNoCharge);
                        }
                        cancelScheduleNoChargeByTime.setParamValue(JsonUtil.toJson(noChargeByTimeList));
                    }
                }*/
                sysparamsList.add(cancelScheduleNoChargeByTime);
            }
            if (dto.getFirstSchePriorityQueueByOneDay() != null) {
                DictSysparams firstSchePriorityQueueByOneDay = new DictSysparams();
                firstSchePriorityQueueByOneDay.setParamName(ConstantsUtil.ConfigName.FIRST_SCHE_PRIORITY_QUEUE_BY_ONE_DAY.getKey());
                firstSchePriorityQueueByOneDay.setMemo("【以天数为单位判断队列优先级的类别】(多个用英文逗号“,”分隔)");
                firstSchePriorityQueueByOneDay.setParamValue(dto.getFirstSchePriorityQueueByOneDay());
                sysparamsList.add(firstSchePriorityQueueByOneDay);
            }
            if (dto.getSelfActLimit() != null) {
                DictSysparams selfActLimit = new DictSysparams();
                selfActLimit.setParamName(ConstantsUtil.ConfigName.SELF_ACT_LIMIT.getKey());
                selfActLimit.setMemo("【限制自助端操作（包括自助机与移动端）】examClass：表示限制操作的检查类别，limitTime：表示限制操作的时间，limitAct：表示限制操作");

                if (dto.getSelfActLimit() != null && dto.getSelfActLimit().size() > 0) {
                    selfActLimit.setParamValue(JsonUtil.toJson(dto.getSelfActLimit()));
                }

                /*if (StringUtils.isNotBlank(dto.getSelfActLimit())) {
                    List<String> selfActLimitList = (List<String>) CommonUtil.split2List(dto.getSelfActLimit());
                    if (!selfActLimitList.isEmpty()) {
                        List<ConfigDto.SelfActLimit> selfActList = new ArrayList<ConfigDto.SelfActLimit>();
                        for (String selfActLimitStr : selfActLimitList) {
                            String[] arr2 = selfActLimitStr.split("=");
                            List<String> examClassList2 = (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? Arrays.asList(arr2[0].split("_")) : new ArrayList<String>();
                            String limitTime = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? arr2[1] : "";
                            List<String> limitActList = (StringUtils.isNotBlank(arr2[2]) && !"空".equals(arr2[2])) ? Arrays.asList(arr2[2].split("_")) : new ArrayList<String>();
                            ConfigDto.SelfActLimit selfAct = new ConfigDto.SelfActLimit();
                            selfAct.setExamClass(examClassList2);
                            selfAct.setLimitTime(limitTime);
                            selfAct.setLimitAct(limitActList);
                            selfActList.add(selfAct);
                        }
                        selfActLimit.setParamValue(JsonUtil.toJson(selfActList));
                    }
                }*/
                sysparamsList.add(selfActLimit);
            }
            if (dto.getNeedClamAgeByItem() != null) {
                DictSysparams needClamAgeByItem = new DictSysparams();
                needClamAgeByItem.setParamName(ConstantsUtil.ConfigName.NEED_CLAM_AGE_BY_ITEM.getKey());
                needClamAgeByItem.setMemo("【需默认镇静的年龄与项目】ageScope：表示年龄区间(转换为天数)，ageStr：表示仅供前端回显使用，examItem：表示检查项目");

                if (dto.getNeedClamAgeByItem() != null && dto.getNeedClamAgeByItem().size() > 0) {
                    dto.getNeedClamAgeByItem().forEach(item -> {
                        if (StringUtils.isNotBlank(item.getAgeStr())) {
                            String[] ageArr = item.getAgeStr().split("~");
                            int min = 0;
                            if (StringUtils.isNotBlank(ageArr[0])) {
                                min = DateUtil.util2Day(ageArr[0]);
                            }
                            int max = 0;
                            if (StringUtils.isNotBlank(ageArr[1])) {
                                max = DateUtil.util2Day(ageArr[1]);
                            }
                            RuleDto.DayScope ageScope = new RuleDto.DayScope();
                            ageScope.setMin(min);
                            ageScope.setMax(max);
                            item.setAgeScope(ageScope);
                        }
                    });
                    needClamAgeByItem.setParamValue(JsonUtil.toJson(dto.getNeedClamAgeByItem()));
                }

                /*if (StringUtils.isNotBlank(dto.getNeedClamAgeByItem())) {
                    List<String> needClamAgeByItemList = (List<String>) CommonUtil.split2List(dto.getNeedClamAgeByItem());
                    if (!needClamAgeByItemList.isEmpty()) {
                        List<ConfigDto.NeedClamAgeByItem> needClamAgeList = new ArrayList<ConfigDto.NeedClamAgeByItem>();
                        for (String needClamAgeByItemStr : needClamAgeByItemList) {
                            String[] arr2 = needClamAgeByItemStr.split("\\|\\|");
                            ConfigDto.NeedClamAgeByItem needClamAge = new ConfigDto.NeedClamAgeByItem();
                            if (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) {
                                String[] ageArr = arr2[0].split("~");
                                int min = 0;
                                if (StringUtils.isNotBlank(ageArr[0]) && !"空".equals(ageArr[0])) {
                                    min = DateUtil.util2Day(ageArr[0]);
                                }
                                int max = 0;
                                if (StringUtils.isNotBlank(ageArr[1]) && !"空".equals(ageArr[1])) {
                                    max = DateUtil.util2Day(ageArr[1]);
                                }
                                RuleDto.DayScope ageScope = new RuleDto.DayScope();
                                ageScope.setMin(Integer.valueOf(min));
                                ageScope.setMax(Integer.valueOf(max));
                                needClamAge.setAgeScope(ageScope);
                                needClamAge.setAgeStr(arr2[0]);
                            }
                            List<String> examItemList = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? Arrays.asList(arr2[1].split("_")) : new ArrayList<String>();
                            if (!examItemList.isEmpty()) {
                                List<DictExamItem> itemList2 = new ArrayList<DictExamItem>();
                                for (String examItemStr : examItemList) {
                                    String[] itemArr = examItemStr.split("=");
                                    DictExamItem item2 = new DictExamItem();
                                    item2.setExamClass(StringUtils.isNotBlank(itemArr[0]) ? itemArr[0] : "");
                                    item2.setItemCode(StringUtils.isNotBlank(itemArr[1]) ? itemArr[1] : "");
                                    item2.setItemName(StringUtils.isNotBlank(itemArr[2]) ? itemArr[2] : "");
                                    itemList2.add(item2);
                                }
                                needClamAge.setExamItem(itemList2);
                            }
                            needClamAgeList.add(needClamAge);
                        }
                        needClamAgeByItem.setParamValue(JsonUtil.toJson(needClamAgeList));
                    }
                }*/
                sysparamsList.add(needClamAgeByItem);
            }
            if (dto.getIsConfirmScheduleByIgnoreDialog() != null) {
                DictSysparams isConfirmScheduleByIgnoreDialog = new DictSysparams();
                isConfirmScheduleByIgnoreDialog.setParamName(ConstantsUtil.ConfigName.IS_CONFIRM_SCHEDULE_BY_IGNORE_DIALOG.getKey());
                isConfirmScheduleByIgnoreDialog.setMemo("【是否启用对已锁定的申请单，确认时跳过二次确认弹窗，点击确定直接确定预约】(1：关闭   0：启用)");
                isConfirmScheduleByIgnoreDialog.setParamValue(configVal(dto.getIsConfirmScheduleByIgnoreDialog(), "1"));
                sysparamsList.add(isConfirmScheduleByIgnoreDialog);
            }
            if (dto.getScheduleLimitByTerminal() != null) {
                DictSysparams scheduleLimitByTerminal = new DictSysparams();
                scheduleLimitByTerminal.setParamName(ConstantsUtil.ConfigName.SCHEDULE_LIMIT_BY_TERMINAL.getKey());
                scheduleLimitByTerminal.setMemo("【自助端修改预约（改约）限制次数】examClass：表示限制预约（改约）的检查类别，terminalType：表示限制预约（改约）的终端类型，limitCount：表示限制预约（改约）的次数");
                if (StringUtils.isNotBlank(dto.getScheduleLimitByTerminal())) {
                    List<String> scheduleLimitByTerminalList = (List<String>) CommonUtil.split2List(dto.getScheduleLimitByTerminal());
                    if (!scheduleLimitByTerminalList.isEmpty()) {
                        List<ConfigDto.ScheduleLimit> scheduleLimitList = new ArrayList<ConfigDto.ScheduleLimit>();
                        for (String scheduleLimitByTerminalStr : scheduleLimitByTerminalList) {
                            String[] arr2 = scheduleLimitByTerminalStr.split("=");
                            List<String> examClassList2 = (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? Arrays.asList(arr2[0].split("_")) : new ArrayList<String>();
                            List<String> terminalTypeList2 = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? Arrays.asList(arr2[1].split("_")) : new ArrayList<String>();
                            Integer limitCount = (StringUtils.isNotBlank(arr2[2]) && !"空".equals(arr2[2])) ? Integer.valueOf(Integer.parseInt(arr2[2])) : null;
                            ConfigDto.ScheduleLimit scheduleLimit = new ConfigDto.ScheduleLimit();
                            scheduleLimit.setExamClass(examClassList2);
                            scheduleLimit.setTerminalType(terminalTypeList2);
                            scheduleLimit.setLimitCount(limitCount);
                            scheduleLimitList.add(scheduleLimit);
                        }
                        scheduleLimitByTerminal.setParamValue(JsonUtil.toJson(scheduleLimitList));
                    }
                }
                sysparamsList.add(scheduleLimitByTerminal);
            }
            if (dto.getIsConfirmFeeBeforeSchedule() != null) {
                DictSysparams isConfirmFeeBeforeSchedule = new DictSysparams();
                isConfirmFeeBeforeSchedule.setParamName(ConstantsUtil.ConfigName.IS_CONFIRM_FEE_BEFORE_SCHEDULE.getKey());
                isConfirmFeeBeforeSchedule.setMemo("【是否启用确认预约时判断确费】(1：关闭   0：启用)");
                isConfirmFeeBeforeSchedule.setParamValue(configVal(dto.getIsConfirmFeeBeforeSchedule(), "1"));
                sysparamsList.add(isConfirmFeeBeforeSchedule);
            }
            if (dto.getConfirmFeeBeforeScheduleUrl() != null) {
                DictSysparams confirmFeeBeforeScheduleUrl = new DictSysparams();
                confirmFeeBeforeScheduleUrl.setParamName(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_URL.getKey());
                confirmFeeBeforeScheduleUrl.setMemo("【确认预约时调用确费链接】注：使用的前提是[yy_isConfirmFeeBeforeSchedule]该配置项要启用！");
                confirmFeeBeforeScheduleUrl.setParamValue(dto.getConfirmFeeBeforeScheduleUrl());
                sysparamsList.add(confirmFeeBeforeScheduleUrl);
            }
            if (dto.getConfirmFeeBeforeScheduleExamClass() != null) {
                DictSysparams confirmFeeBeforeScheduleExamClass = new DictSysparams();
                confirmFeeBeforeScheduleExamClass.setParamName(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_EXAM_CLASS.getKey());
                confirmFeeBeforeScheduleExamClass.setMemo("【根据检查类别确认预约时确费】注：使用的前提是[yy_isConfirmFeeBeforeSchedule]该配置项要启用！");
                confirmFeeBeforeScheduleExamClass.setParamValue(dto.getConfirmFeeBeforeScheduleExamClass());
                sysparamsList.add(confirmFeeBeforeScheduleExamClass);
            }
            if (dto.getConfirmFeeBeforeSchedulePatientSource() != null) {
                DictSysparams confirmFeeBeforeSchedulePatientSource = new DictSysparams();
                confirmFeeBeforeSchedulePatientSource.setParamName(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SCHEDULE_PATIENT_SOURCE.getKey());
                confirmFeeBeforeSchedulePatientSource.setMemo("【根据病人来源确认预约时确费】注：使用的前提是[yy_isConfirmFeeBeforeSchedule]该配置项要启用！");
                confirmFeeBeforeSchedulePatientSource.setParamValue(dto.getConfirmFeeBeforeSchedulePatientSource());
                sysparamsList.add(confirmFeeBeforeSchedulePatientSource);
            }
            if (dto.getIsNotUpdateChargeFlagByConfirmFee() != null) {
                DictSysparams isNotUpdateChargeFlagByConfirmFee = new DictSysparams();
                isNotUpdateChargeFlagByConfirmFee.setParamName(ConstantsUtil.ConfigName.IS_NOT_UPDATE_CHARGE_FLAG_BY_CONFIRM_FEE.getKey());
                isNotUpdateChargeFlagByConfirmFee.setMemo("【不修改缴费标识，仅修改医嘱执行状态(预约)】(1：关闭   0：启用)注：使用的前提是[yy_isConfirmFeeBeforeSchedule]该配置项要启用！");
                isNotUpdateChargeFlagByConfirmFee.setParamValue(dto.getIsNotUpdateChargeFlagByConfirmFee());
                sysparamsList.add(isNotUpdateChargeFlagByConfirmFee);
            }
            if (dto.getIsNotUpdateChargeFlagByRecedeCost() != null) {
                DictSysparams isNotUpdateChargeFlagByRecedeCost = new DictSysparams();
                isNotUpdateChargeFlagByRecedeCost.setParamName(ConstantsUtil.ConfigName.IS_NOT_UPDATE_CHARGE_FLAG_BY_RECEDE_COST.getKey());
                isNotUpdateChargeFlagByRecedeCost.setMemo("【不修改缴费标识，仅修改医嘱执行状态(取消预约)】(1：关闭   0：启用)注：使用的前提是[yy_isRecedeCostByCancel]该配置项要启用！");
                isNotUpdateChargeFlagByRecedeCost.setParamValue(dto.getIsNotUpdateChargeFlagByRecedeCost());
                sysparamsList.add(isNotUpdateChargeFlagByRecedeCost);
            }
            if (dto.getIsOpenDelApplyBtn() != null) {
                DictSysparams isOpenDelApplyBtn = new DictSysparams();
                isOpenDelApplyBtn.setParamName(ConstantsUtil.ConfigName.IS_OPEN_DEL_APPLY_BTN.getKey());
                isOpenDelApplyBtn.setMemo("【是否启用【综合查询】及【临床预约】界面显示【作废申请单】按钮】(1：关闭   0：启用)");
                isOpenDelApplyBtn.setParamValue(dto.getIsOpenDelApplyBtn());
                sysparamsList.add(isOpenDelApplyBtn);
            }
            if (dto.getOnlyMatchApmByClamApply() != null) {
                DictSysparams onlyMatchApmByClamApply = new DictSysparams();
                onlyMatchApmByClamApply.setParamName(ConstantsUtil.ConfigName.ONLY_MATCH_APM_BY_CLAM_APPLY.getKey());
                onlyMatchApmByClamApply.setMemo("【镇静申请单只可预约相应时长后的时段】examClass：表示检查类别，limitTime：表示只能预约“N”小时之后(带单位时间)");

                if (dto.getOnlyMatchApmByClamApply() != null && dto.getOnlyMatchApmByClamApply().size() > 0) {
                    onlyMatchApmByClamApply.setParamValue(JsonUtil.toJson(dto.getOnlyMatchApmByClamApply()));
                }

                /*if (StringUtils.isNotBlank(dto.getOnlyMatchApmByClamApply())) {
                    List<String> onlyMatchApmByClamApplyList = (List<String>) CommonUtil.split2List(dto.getOnlyMatchApmByClamApply());
                    if (!onlyMatchApmByClamApplyList.isEmpty()) {
                        List<ConfigDto.CommonSet> commonSetList = new ArrayList<ConfigDto.CommonSet>();
                        for (String onlyMatchApmByClamApplyStr : onlyMatchApmByClamApplyList) {
                            ConfigDto.CommonSet commonSet = new ConfigDto.CommonSet();
                            String[] arr = onlyMatchApmByClamApplyStr.split("=");
                            List<String> examClassList = (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? Arrays.asList(arr[0].split("_")) : new ArrayList<String>();
                            commonSet.setExamClass(examClassList);
                            if (StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) {
                                String limitTime2 = arr[1];
                                String value = "";
                                String unit = "天";
                                if (limitTime2.endsWith("天")) {
                                    value = limitTime2.substring(0, limitTime2.lastIndexOf("天"));
                                    unit = limitTime2.substring(limitTime2.lastIndexOf("天"));
                                } else {
                                    value = limitTime2.substring(0, limitTime2.lastIndexOf("小时"));
                                    unit = limitTime2.substring(limitTime2.lastIndexOf("小时"));
                                }
                                commonSet.setValue(value);
                                commonSet.setUnit(unit);
                                commonSet.setLimitTime(limitTime2);
                            }
                            commonSetList.add(commonSet);
                        }
                        onlyMatchApmByClamApply.setParamValue(JsonUtil.toJson(commonSetList));
                    }
                }*/
                sysparamsList.add(onlyMatchApmByClamApply);
            }
            if (dto.getIsNeedPasswordByDeptsche() != null) {
                DictSysparams isNeedPasswordByDeptsche = new DictSysparams();
                isNeedPasswordByDeptsche.setParamName(ConstantsUtil.ConfigName.IS_NEED_PASSWORD_BY_DEPTSCHE.getKey());
                isNeedPasswordByDeptsche.setMemo("【是否启用改约/取消/修改申请单时需填密码(医技端)】(1：关闭   0：启用),注：密码是登录账户的密码");
                isNeedPasswordByDeptsche.setParamValue(dto.getIsNeedPasswordByDeptsche());
                sysparamsList.add(isNeedPasswordByDeptsche);
            }
            if (dto.getNeedPasswordExamClassByDeptsche() != null) {
                DictSysparams needPasswordExamClassByDeptsche = new DictSysparams();
                needPasswordExamClassByDeptsche.setParamName(ConstantsUtil.ConfigName.NEED_PASSWORD_EXAM_CLASS_BY_DEPTSCHE.getKey());
                needPasswordExamClassByDeptsche.setMemo("【改约/取消/修改申请单时需填密码(医技端)的检查类别】(多个用英文逗号“,”分隔)");
                needPasswordExamClassByDeptsche.setParamValue(dto.getNeedPasswordExamClassByDeptsche());
                sysparamsList.add(needPasswordExamClassByDeptsche);
            }
            if (dto.getChargeFirstTerminalType() != null) {
                DictSysparams chargeFirstTerminalType = new DictSysparams();
                chargeFirstTerminalType.setParamName(ConstantsUtil.ConfigName.CHARGE_FIRST_TERMINAL_TYPE.getKey());
                chargeFirstTerminalType.setMemo("【限制先缴费后预约的终端类型】(多个用英文逗号“,”分隔)");
                chargeFirstTerminalType.setParamValue(dto.getChargeFirstTerminalType());
                sysparamsList.add(chargeFirstTerminalType);
            }
            if (dto.getNoShowOnlyDeptscheScheduleByTerminalType() != null) {
                DictSysparams noShowOnlyDeptscheScheduleByTerminalType = new DictSysparams();
                noShowOnlyDeptscheScheduleByTerminalType.setParamName(ConstantsUtil.ConfigName.NO_SHOW_ONLY_DEPTSCHE_SCHEDULE_BY_TERMINAL_TYPE.getKey());
                noShowOnlyDeptscheScheduleByTerminalType.setMemo("【隐藏【仅医技前台预约】的项目的终端】(多个用英文逗号“,”分隔)");
                noShowOnlyDeptscheScheduleByTerminalType.setParamValue(dto.getNoShowOnlyDeptscheScheduleByTerminalType());
                sysparamsList.add(noShowOnlyDeptscheScheduleByTerminalType);
            }
            if (dto.getIsAutoScheduleByTimingTask() != null) {
                DictSysparams isAutoScheduleByTimingTask = new DictSysparams();
                isAutoScheduleByTimingTask.setParamName(ConstantsUtil.ConfigName.IS_AUTO_SCHEDULE_BY_TIMING_TASK.getKey());
                isAutoScheduleByTimingTask.setMemo("【启用定时调用自动预约】(1：关闭   0：启用)");
                isAutoScheduleByTimingTask.setParamValue(configVal(dto.getIsAutoScheduleByTimingTask(), "1"));
                sysparamsList.add(isAutoScheduleByTimingTask);
            }
            if (dto.getAutoScheduleByTimingTask() != null) {
                DictSysparams autoScheduleByTimingTask = new DictSysparams();
                autoScheduleByTimingTask.setParamName(ConstantsUtil.ConfigName.AUTO_SCHEDULE_BY_TIMING_TASK.getKey());
                autoScheduleByTimingTask.setMemo("【定时调用自动预约】注：使用的前提是[yy_isAutoScheduleByTimingTask]该配置项已启用,examClass:检查类别,patientSource:病人来源,filterFlag:过滤申请单,limitTime:时间点,day:申请单日期范围");
                if (!dto.getAutoScheduleByTimingTask().isEmpty()) {
                    dto.getAutoScheduleByTimingTask().removeIf(autoScheduleSet -> (autoScheduleSet.getExamClass() == null || autoScheduleSet.getExamClass().isEmpty()) && (autoScheduleSet.getPatientSource() == null || autoScheduleSet.getPatientSource().isEmpty()) && (autoScheduleSet.getFilterFlag() == null || autoScheduleSet.getFilterFlag().isEmpty()) && StringUtils.isBlank(autoScheduleSet.getLimitTime()) && autoScheduleSet.getDay() != null);
                    autoScheduleByTimingTask.setParamValue(dto.getAutoScheduleByTimingTask().isEmpty() ? "" : JsonUtil.toJson(dto.getAutoScheduleByTimingTask()));
                }
                sysparamsList.add(autoScheduleByTimingTask);
            }
            if (dto.getGetHisApplyByHospital() != null) {
                DictSysparams getHisApplyByHospital = new DictSysparams();
                getHisApplyByHospital.setParamName(ConstantsUtil.ConfigName.GET_HIS_APPLY_BY_HOSPITAL.getKey());
                getHisApplyByHospital.setMemo("【开启配置前提下，根据院区代码调用获取第三方HIS的申请单接口】(多个用英文逗号“,”分隔)注：使用的前提是[yy_isGetHisApplyByThirdWS]该配置项已启用");
                getHisApplyByHospital.setParamValue(dto.getGetHisApplyByHospital());
                sysparamsList.add(getHisApplyByHospital);
            }
            if (dto.getScheduleStatusByConfirmFee() != null) {
                DictSysparams scheduleStatusByConfirmFee = new DictSysparams();
                scheduleStatusByConfirmFee.setParamName(ConstantsUtil.ConfigName.SCHEDULE_STATUS_BY_CONFIRM_FEE.getKey());
                scheduleStatusByConfirmFee.setMemo("【确费失败时预约状态(预约)】(0:待确认   1:未预约)注：使用的前提是[yy_isConfirmFeeBeforeSchedule]该配置项要启用！");
                scheduleStatusByConfirmFee.setParamValue(dto.getScheduleStatusByConfirmFee());
                sysparamsList.add(scheduleStatusByConfirmFee);
            }
            if (dto.getIsScanBtnByScheduleSign() != null) {
                DictSysparams isScanBtnByScheduleSign = new DictSysparams();
                isScanBtnByScheduleSign.setParamName(ConstantsUtil.ConfigName.IS_SCAN_BTN_BY_SCHEDULE_SIGN.getKey());
                isScanBtnByScheduleSign.setMemo("【是否启用显示[预约报到]界面的扫描按钮】(1：关闭   0：启用)");
                isScanBtnByScheduleSign.setParamValue(configVal(dto.getIsScanBtnByScheduleSign(), "1"));
                sysparamsList.add(isScanBtnByScheduleSign);
            }
            if (dto.getIsDynamicSource() != null) {
                DictSysparams isDynamicSource = new DictSysparams();
                isDynamicSource.setParamName(ConstantsUtil.ConfigName.IS_DYNAMIC_SOURCE.getKey());
                isDynamicSource.setMemo("【预约当前时段的号源时根据当前时间动态减少号源】(1：关闭   0：启用)");
                isDynamicSource.setParamValue(configVal(dto.getIsDynamicSource(), "1"));
                sysparamsList.add(isDynamicSource);
            }

            /* 预约生成排队号的检查类别
            if (dto.getQueueNoByExamClass() != null) {
                DictSysparams queueNoByExamClass = new DictSysparams();
                queueNoByExamClass.setParamName(ConstantsUtil.ConfigName.QUEUE_NO_CLASS.getKey());
                queueNoByExamClass.setMemo("【预约生成排队号的检查类别，非预约立即取号流程,会调用ST_GetQueueNo函数生成，空不生成】(多个用英文逗号“,”分隔)");
                queueNoByExamClass.setParamValue(dto.getQueueNoByExamClass());
                sysparamsList.add(queueNoByExamClass);
            }*/
            /* 绿色通道生成排队号的检查类别
            if (dto.getNoRegularQueueNoClass() != null) {
                DictSysparams noRegularQueueNoClass = new DictSysparams();
                noRegularQueueNoClass.setParamName(ConstantsUtil.ConfigName.NO_REGULAR_QUEUE_NO_CLASS.getKey());
                noRegularQueueNoClass.setMemo("【绿色通道生成排队号的检查类别】(多个用英文逗号“,”分隔)");
                noRegularQueueNoClass.setParamValue(dto.getNoRegularQueueNoClass());
                sysparamsList.add(noRegularQueueNoClass);
            }*/

            /* 需要在预约前选择更新无痛标识的项目
            if (dto.getEditItemFlagBeforeSchedule() != null) {
                DictSysparams editItemFlagBeforeSchedule = new DictSysparams();
                editItemFlagBeforeSchedule.setParamName(ConstantsUtil.ConfigName.EDIT_ITEM_FLAG_BEFORE_SCHEDULE.getKey());
                editItemFlagBeforeSchedule.setMemo("【需要在预约前选择更新无痛标识的项目】");
                if (StringUtils.isNotBlank(dto.getEditItemFlagBeforeSchedule())) {
                    List<String> editItemFlagBeforeScheduleList = (List<String>) CommonUtil.split2List(dto.getEditItemFlagBeforeSchedule());
                    if (!editItemFlagBeforeScheduleList.isEmpty()) {
                        List<DictExamItem> itemList = new ArrayList<DictExamItem>();
                        for (String editItemFlag : editItemFlagBeforeScheduleList) {
                            DictExamItem item = new DictExamItem();
                            String[] arr = editItemFlag.split("=");
                            item.setExamClass(StringUtils.isNotBlank(arr[0]) ? arr[0] : "");
                            item.setItemCode(StringUtils.isNotBlank(arr[1]) ? arr[1] : "");
                            item.setItemName(StringUtils.isNotBlank(arr[2]) ? arr[2] : "");
                            itemList.add(item);
                        }
                        editItemFlagBeforeSchedule.setParamValue(JsonUtil.toJson(itemList));
                    }
                }
                sysparamsList.add(editItemFlagBeforeSchedule);
            }*/

            // 条码打印设置
            /* 点击打印按钮1次，打印多少张
            DictSysparams clickBtnByPrintNum = new DictSysparams();
            clickBtnByPrintNum.setParamName(ConstantsUtil.ConfigName.CLICK_BTN_BY_PRINT_NUM.getKey());
            clickBtnByPrintNum.setMemo("【点击打印按钮1次，打印多少张】默认为1张");
            clickBtnByPrintNum.setParamValue((dto.getClickBtnByPrintNum() != null) ? String.valueOf(dto.getClickBtnByPrintNum()) : "1");
            sysparamsList.add(clickBtnByPrintNum);*/
            /* 预约成功后自动打印条码，1次打印多少张
            DictSysparams autoPrintNumAfterSchedule = new DictSysparams();
            autoPrintNumAfterSchedule.setParamName(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_AFTER_SCHEDULE.getKey());
            autoPrintNumAfterSchedule.setMemo("【预约成功后自动打印条码，1次打印多少张】默认为1张");
            autoPrintNumAfterSchedule.setParamValue((dto.getAutoPrintNumAfterSchedule() != null) ? String.valueOf(dto.getAutoPrintNumAfterSchedule()) : "1");
            sysparamsList.add(autoPrintNumAfterSchedule);*/
            /* 可根据[检查项目]预约成功后自动打印一次性打印多少张
            if (dto.getAutoPrintNumByItem() != null) {
                DictSysparams autoPrintNumByItem = new DictSysparams();
                autoPrintNumByItem.setParamName(ConstantsUtil.ConfigName.AUTO_PRINT_NUM_BY_ITEM.getKey());
                autoPrintNumByItem.setMemo("【可根据[检查项目]预约成功后自动打印一次性打印多少张】");
                autoPrintNumByItem.setParamValue(dto.getAutoPrintNumByItem().isEmpty() ? "" : JsonUtil.toJson(dto.getAutoPrintNumByItem()));
                sysparamsList.add(autoPrintNumByItem);
            }*/

            /* 患者预约需要审核的检查项目
            if (dto.getNeedConfirmItem() != null) {
                DictSysparams needConfirmItem = new DictSysparams();
                needConfirmItem.setParamName(ConstantsUtil.ConfigName.NEED_CONFIRM_ITEM.getKey());
                needConfirmItem.setMemo("【患者预约需要审核的检查项目】");
                if (StringUtils.isNotBlank(dto.getNeedConfirmItem())) {
                    List<String> needConfirmItemList = (List<String>) CommonUtil.split2List(dto.getNeedConfirmItem());
                    if (!needConfirmItemList.isEmpty()) {
                        List<DictExamItem> itemList = new ArrayList<DictExamItem>();
                        for (String confirmItem : needConfirmItemList) {
                            DictExamItem item = new DictExamItem();
                            String[] arr = confirmItem.split("=");
                            item.setExamClass(StringUtils.isNotBlank(arr[0]) ? arr[0] : "");
                            item.setItemCode(StringUtils.isNotBlank(arr[1]) ? arr[1] : "");
                            item.setItemName(StringUtils.isNotBlank(arr[2]) ? arr[2] : "");
                            itemList.add(item);
                        }
                        needConfirmItem.setParamValue(JsonUtil.toJson(itemList));
                    }
                }
                sysparamsList.add(needConfirmItem);
            }*/

            // 预约凭条设置
            /* 预约成功后自动打印凭条
            if (dto.getRemindPrintTicketAfterSchedule() != null) {
                DictSysparams remindPrintTicketAfterSchedule = new DictSysparams();
                remindPrintTicketAfterSchedule.setParamName(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SCHEDULE.getKey());
                remindPrintTicketAfterSchedule.setMemo("【预约成功后，可根据终端类型、检查类别、病人来源提醒是否要打印凭条】printTicketTerminalType：表示预约凭条终端类型；printTicketExamClass：表示预约凭条检查类别；printTicketPatientSource：表示预约凭条病人来源；");

                if (dto.getRemindPrintTicketAfterSchedule() != null) {
                    List<ConfigDto.PrintTicketAfterSchedule> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSchedule>();
                    ConfigDto.PrintTicketAfterSchedule ticket = new ConfigDto.PrintTicketAfterSchedule();
                    ticket.setPrintTicketExamClass(new ArrayList<>());
                    ticket.setPrintTicketPatientSource(new ArrayList<>());
                    dto.getPrintTicketAfterSchedule().forEach(vo -> {
                        ticket.setPrintTicketTerminalType(StringUtils.isNotBlank(vo.getPrintTicketTerminalType()) ? vo.getPrintTicketTerminalType() : null);
                        vo.getPrintTicketExamClass().forEach(item -> {
                            if (StringUtils.isNotBlank(item)) {
                                ticket.getPrintTicketExamClass().add(item);
                            }
                        });
                        vo.getPrintTicketPatientSource().forEach(item -> {
                            if (StringUtils.isNotBlank(item)) {
                                ticket.getPrintTicketPatientSource().add(item);
                            }
                        });
                        ticketList.add(ticket);
                    });
                    remindPrintTicketAfterSchedule.setParamValue(JsonUtil.toJson(ticketList));
                }

                *//*if (StringUtils.isNotBlank(dto.getRemindPrintTicketAfterSchedule())) {
                    List<String> remindPrintTicketAfterScheduleList = (List<String>) CommonUtil.split2List(dto.getRemindPrintTicketAfterSchedule());
                    if (!remindPrintTicketAfterScheduleList.isEmpty()) {
                        List<ConfigDto.PrintTicketAfterSchedule> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSchedule>();
                        for (String remindPrintTicket : remindPrintTicketAfterScheduleList) {
                            ConfigDto.PrintTicketAfterSchedule ticket = new ConfigDto.PrintTicketAfterSchedule();
                            String[] arr = remindPrintTicket.split("=");
                            String printTicketTerminalType = (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? arr[0] : "";
                            List<String> printTicketExamClassList = (StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) ? Arrays.asList(arr[1].split("_")) : new ArrayList<String>();
                            List<String> printTicketPatientSourceList = (StringUtils.isNotBlank(arr[2]) && !"空".equals(arr[2])) ? Arrays.asList(arr[2].split("_")) : new ArrayList<String>();
                            ticket.setPrintTicketTerminalType(printTicketTerminalType);
                            ticket.setPrintTicketExamClass(printTicketExamClassList);
                            ticket.setPrintTicketPatientSource(printTicketPatientSourceList);
                            ticketList.add(ticket);
                        }
                        remindPrintTicketAfterSchedule.setParamValue(JsonUtil.toJson(ticketList));
                    }
                }*//*
                sysparamsList.add(remindPrintTicketAfterSchedule);
            }*/
            /* 预约成功后是否提醒打印凭条
            if (dto.getPrintTicketAfterSchedule() != null) {
                DictSysparams printTicketAfterSchedule = new DictSysparams();
                printTicketAfterSchedule.setParamName(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SCHEDULE.getKey());
                printTicketAfterSchedule.setMemo("【预约成功后，可根据终端类型、检查类别、病人来源自动打印预约凭条】printTicketTerminalType：表示预约凭条终端类型；printTicketExamClass：表示预约凭条检查类别；printTicketPatientSource：表示预约凭条病人来源；");

                if (dto.getPrintTicketAfterSchedule() != null) {
                    List<ConfigDto.PrintTicketAfterSchedule> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSchedule>();
                    ConfigDto.PrintTicketAfterSchedule ticket = new ConfigDto.PrintTicketAfterSchedule();
                    ticket.setPrintTicketExamClass(new ArrayList<>());
                    ticket.setPrintTicketPatientSource(new ArrayList<>());
                    dto.getPrintTicketAfterSchedule().forEach(vo -> {
                            ticket.setPrintTicketTerminalType(StringUtils.isNotBlank(vo.getPrintTicketTerminalType()) ? vo.getPrintTicketTerminalType() : null);
                            vo.getPrintTicketExamClass().forEach(item -> {
                                if (StringUtils.isNotBlank(item)) {
                                    ticket.getPrintTicketExamClass().add(item);
                                }
                            });
                            vo.getPrintTicketPatientSource().forEach(item -> {
                                if (StringUtils.isNotBlank(item)) {
                                    ticket.getPrintTicketPatientSource().add(item);
                                }
                            });
                            ticketList.add(ticket);
                    });
                    printTicketAfterSchedule.setParamValue(JsonUtil.toJson(ticketList));
                }

                *//*if (StringUtils.isNotBlank(dto.getPrintTicketAfterSchedule())) {
                    List<String> printTicketAfterScheduleList = (List<String>) CommonUtil.split2List(dto.getPrintTicketAfterSchedule());
                    if (!printTicketAfterScheduleList.isEmpty()) {
                        List<ConfigDto.PrintTicketAfterSchedule> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSchedule>();
                        for (String printTicket : printTicketAfterScheduleList) {
                            ConfigDto.PrintTicketAfterSchedule ticket = new ConfigDto.PrintTicketAfterSchedule();
                            String[] arr = printTicket.split("=");
                            String printTicketTerminalType = (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? arr[0] : "";
                            List<String> printTicketExamClassList = (StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) ? Arrays.asList(arr[1].split("_")) : new ArrayList<String>();
                            List<String> printTicketPatientSourceList = (StringUtils.isNotBlank(arr[2]) && !"空".equals(arr[2])) ? Arrays.asList(arr[2].split("_")) : new ArrayList<String>();
                            ticket.setPrintTicketTerminalType(printTicketTerminalType);
                            ticket.setPrintTicketExamClass(printTicketExamClassList);
                            ticket.setPrintTicketPatientSource(printTicketPatientSourceList);
                            ticketList.add(ticket);
                        }
                        printTicketAfterSchedule.setParamValue(JsonUtil.toJson(ticketList));
                    }
                }*//*
                sysparamsList.add(printTicketAfterSchedule);
            }*/

            // 第三方HIS申请单设置
            /* 是否开启调用获取第三方HIS的申请单接口
            if (dto.getIsGetHisApplyByThirdWS() != null) {
                DictSysparams isGetHisApplyByThirdWS = new DictSysparams();
                isGetHisApplyByThirdWS.setParamName(ConstantsUtil.ConfigName.IS_GET_HIS_APPLY_BY_THIRD_WS.getKey());
                isGetHisApplyByThirdWS.setMemo("【是否开启调用获取第三方HIS的申请单接口】(1：关闭   0：启用)，applyUrl：表示第三方HIS接口服务的链接地址");
                if (StringUtils.isNotBlank(dto.getIsGetHisApplyByThirdWS())) {
                    ConfigDto.GetHisApplyByThirdWS getHisApplyByThirdWS = new ConfigDto.GetHisApplyByThirdWS();
                    getHisApplyByThirdWS.setGrant(dto.getIsGetHisApplyByThirdWS());
                    getHisApplyByThirdWS.setApplyUrl(dto.getApplyUrl());
                    isGetHisApplyByThirdWS.setParamValue(JsonUtil.toJson(getHisApplyByThirdWS));
                }
                sysparamsList.add(isGetHisApplyByThirdWS);
            }*/

            /* 短信通知 {去掉}
            if (dto.getIsSmsNoticeForSchedule() != null) {
                DictSysparams isSmsNoticeForSchedule = new DictSysparams();
                isSmsNoticeForSchedule.setParamName(ConstantsUtil.ConfigName.IS_SMS_NOTICE_FOR_SCHEDULE.getKey());
                isSmsNoticeForSchedule.setMemo("【“预约成功”短信通知】(1：关闭   0：启用)");
                isSmsNoticeForSchedule.setParamValue(configVal(dto.getIsSmsNoticeForSchedule(), "1"));
                sysparamsList.add(isSmsNoticeForSchedule);
            }
            if (dto.getIsSmsNoticeForDelSchedule() != null) {
                DictSysparams isSmsNoticeForDelSchedule = new DictSysparams();
                isSmsNoticeForDelSchedule.setParamName(ConstantsUtil.ConfigName.IS_SMS_NOTICE_FOR_DEL_SCHEDULE.getKey());
                isSmsNoticeForDelSchedule.setMemo("【“取消预约”短信通知】(1：关闭   0：启用)");
                isSmsNoticeForDelSchedule.setParamValue(configVal(dto.getIsSmsNoticeForDelSchedule(), "1"));
                sysparamsList.add(isSmsNoticeForDelSchedule);
            }
            if (dto.getSmsNoticePatientSource() != null) {
                DictSysparams smsNoticePatientSource = new DictSysparams();
                smsNoticePatientSource.setParamName(ConstantsUtil.ConfigName.SMS_NOTICE_PATIENT_SOURCE.getKey());
                smsNoticePatientSource.setMemo("【按病人来源开启短信通知】");
                smsNoticePatientSource.setParamValue(dto.getSmsNoticePatientSource());
                sysparamsList.add(smsNoticePatientSource);
            }
            if (dto.getSmsNoticeQueue() != null) {
                DictSysparams smsNoticeQueue = new DictSysparams();
                smsNoticeQueue.setParamName(ConstantsUtil.ConfigName.SMS_NOTICE_QUEUE.getKey());
                smsNoticeQueue.setMemo("【按队列开启短信通知】");
                if (StringUtils.isNotBlank(dto.getSmsNoticeQueue())) {
                    List<String> smsNoticeQueueList = (List<String>) CommonUtil.split2List(dto.getSmsNoticeQueue());
                    if (!smsNoticeQueueList.isEmpty()) {
                        List<DictExamQueue> queueList = new ArrayList<DictExamQueue>();
                        for (String noticeQueue : smsNoticeQueueList) {
                            DictExamQueue queue = new DictExamQueue();
                            String[] arr = noticeQueue.split("=");
                            queue.setExamClass(StringUtils.isNotBlank(arr[0]) ? arr[0] : "");
                            queue.setQueueName(StringUtils.isNotBlank(arr[1]) ? arr[1] : "");
                            queueList.add(queue);
                        }
                        smsNoticeQueue.setParamValue(JsonUtil.toJson(queueList));
                    }
                }
                sysparamsList.add(smsNoticeQueue);
            }*/

            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    private JsonResult saveConfig4Sign(DictSysparamsDto dto) {
        if (dto != null) {
            List<DictSysparams> sysparamsList = new ArrayList<DictSysparams>();

            // 数据库中已不存在的设置
            /*if (dto.getIsChargeAfterSign() != null) {
                DictSysparams isChargeAfterSign = new DictSysparams();
                isChargeAfterSign.setParamName(ConstantsUtil.ConfigName.IS_CHARGE_AFTER_SIGN.getKey());
                isChargeAfterSign.setMemo("【报到成功后执行扣费】(1：关闭   0：启用)，noChargeExamClass：表示不需要扣费的检查类别");
                if (StringUtils.isNotBlank(dto.getIsChargeAfterSign())) {
                    ConfigDto.ChargeAfterSign chargeAfterSign = new ConfigDto.ChargeAfterSign();
                    chargeAfterSign.setGrant(dto.getIsChargeAfterSign());
                    if (StringUtils.isNotBlank(dto.getNoChargeSignExamClass())) {
                        chargeAfterSign.setNoChargeExamClass(CommonUtil.split2List(dto.getNoChargeSignExamClass()));
                    }
                    isChargeAfterSign.setParamValue(JsonUtil.toJson(chargeAfterSign));
                }
                sysparamsList.add(isChargeAfterSign);
            }*/
            /*if (dto.getIsScheduleIntervalBySign() != null) {
                DictSysparams isScheduleIntervalBySign = new DictSysparams();
                isScheduleIntervalBySign.setParamName(ConstantsUtil.ConfigName.IS_SCHEDULE_INTERVAL_BY_SIGN.getKey());
                isScheduleIntervalBySign.setMemo("【报到按时段限制】(1：关闭   0：启用)");
                isScheduleIntervalBySign.setParamValue(configVal(dto.getIsScheduleIntervalBySign(), "1"));
                sysparamsList.add(isScheduleIntervalBySign);
            }*/
            /*if (dto.getIsScannerAfterSign() != null) {
                DictSysparams isScannerAfterSign = new DictSysparams();
                isScannerAfterSign.setParamName(ConstantsUtil.ConfigName.IS_SCANNER_AFTER_SIGN.getKey());
                isScannerAfterSign.setMemo("【报到后扫描申请单】(1：关闭   0：启用)");
                isScannerAfterSign.setParamValue(configVal(dto.getIsScannerAfterSign(), "1"));
                sysparamsList.add(isScannerAfterSign);
            }*/
            /*if (dto.getChargeAfterSignUrl() != null) {
                DictSysparams chargeAfterSignUrl = new DictSysparams();
                chargeAfterSignUrl.setParamName(ConstantsUtil.ConfigName.CHARGE_AFTER_SIGN_URL.getKey());
                chargeAfterSignUrl.setMemo("【报到成功后执行扣费接口链接】注：使用的前提是[yy_chargeAfterExamClassBySign]该配置项已配置了检查类别！");
                chargeAfterSignUrl.setParamValue(dto.getChargeAfterSignUrl());
                sysparamsList.add(chargeAfterSignUrl);
            }*/
            /*if (dto.getChargeAfterExamClassBySign() != null) {
                DictSysparams chargeAfterExamClassBySign = new DictSysparams();
                chargeAfterExamClassBySign.setParamName(ConstantsUtil.ConfigName.CHARGE_AFTER_EXAM_CLASS_BY_SIGN.getKey());
                chargeAfterExamClassBySign.setMemo("【报到成功后执行扣费的类别】(多个用英文逗号“,”分隔)");
                chargeAfterExamClassBySign.setParamValue(dto.getChargeAfterExamClassBySign());
                sysparamsList.add(chargeAfterExamClassBySign);
            }*/

            /* 第三方报到设置-启用通过第三方 RIS 提供的接口报到
            if (dto.getIsSignScheduleByThirdWS() != null) {
                DictSysparams isSignScheduleByThirdWS = new DictSysparams();
                isSignScheduleByThirdWS.setParamName(ConstantsUtil.ConfigName.IS_SIGN_SCHEDULE_BY_THIRD_WS.getKey());
                isSignScheduleByThirdWS.setMemo("【通过第三方RIS提供的接口报到】(1：关闭   0：启用)，signExamClass：表示报到类别，signUrl：表示报到接口地址，cancelUrl：表示取消报到接口地址，queueNoSub：表示第三方报到接口返回排队号截取位置");
                if (StringUtils.isNotBlank(dto.getIsSignScheduleByThirdWS())) {
                    ConfigDto.SignScheduleByThirdWS signScheduleByThirdWS = new ConfigDto.SignScheduleByThirdWS();
                    signScheduleByThirdWS.setGrant(dto.getIsSignScheduleByThirdWS());
                    signScheduleByThirdWS.setSignUrl(dto.getSignUrl());
                    signScheduleByThirdWS.setCancelUrl(dto.getCancelUrl());
                    if (StringUtils.isNotBlank(dto.getSignInfoSets())) {
                        List<String> signInfoSetList = (List<String>) CommonUtil.split2List(dto.getSignInfoSets());
                        if (!signInfoSetList.isEmpty()) {
                            List<ConfigDto.SignInfoSet> infoSetList = new ArrayList<ConfigDto.SignInfoSet>();
                            for (String signInfoSet : signInfoSetList) {
                                ConfigDto.SignInfoSet infoSet = new ConfigDto.SignInfoSet();
                                String[] setArr = signInfoSet.split("=");
                                infoSet.setSignExamClass(Arrays.asList(setArr[0].split("_")));
                                infoSet.setQueueNoSub(Integer.valueOf((StringUtils.isNotBlank(setArr[1]) && !"空".equals(setArr[1])) ? Integer.parseInt(setArr[1]) : 0));
                                infoSetList.add(infoSet);
                            }
                            signScheduleByThirdWS.setSignInfoSet(infoSetList);
                        }
                    }
                    isSignScheduleByThirdWS.setParamValue(JsonUtil.toJson(signScheduleByThirdWS));
                }
                sysparamsList.add(isSignScheduleByThirdWS);
            }*/

            /* 预约取号设置-启用预约后就取号
            if (dto.getIsTakeNoQueue() != null) {
                DictSysparams isTakeNoQueue = new DictSysparams();
                isTakeNoQueue.setParamName(ConstantsUtil.ConfigName.IS_TAKE_NO_QUEUE.getKey());
                isTakeNoQueue.setMemo("【预约后就取号】(1：关闭   0：启用)，openPatientSource：表示开放的病人来源，openQueue：表示开放的队列");
                if (StringUtils.isNotBlank(dto.getIsTakeNoQueue())) {
                    ConfigDto.TakeNoQueue takeNoQueue = new ConfigDto.TakeNoQueue();
                    takeNoQueue.setGrant(dto.getIsTakeNoQueue());
                    if (StringUtils.isNotBlank(dto.getOpenPatientSource())) {
                        takeNoQueue.setOpenPatientSource(CommonUtil.split2List(dto.getOpenPatientSource()));
                    }
                    if (StringUtils.isNotBlank(dto.getOpenQueue())) {
                        List<String> openQueueList = (List<String>) CommonUtil.split2List(dto.getOpenQueue());
                        if (openQueueList.size() > 0) {
                            List<DictExamQueue> queueList = new ArrayList<DictExamQueue>();
                            for (String openQueue : openQueueList) {
                                DictExamQueue dictExamQueue = new DictExamQueue();
                                String[] arr = openQueue.split("=");
                                dictExamQueue.setExamClass(StringUtils.isNotBlank(arr[0]) ? arr[0] : "");
                                dictExamQueue.setQueueName(StringUtils.isNotBlank(arr[1]) ? arr[1] : "");
                                queueList.add(dictExamQueue);
                            }
                            takeNoQueue.setOpenQueue(queueList);
                        }
                    }
                    isTakeNoQueue.setParamValue(JsonUtil.toJson(takeNoQueue));
                }
                sysparamsList.add(isTakeNoQueue);
            }*/

            /* 报到凭条设置-报到成功后自动打印凭条
            if (dto.getPrintTicketAfterSign() != null) {
                DictSysparams printTicketAfterSign = new DictSysparams();
                printTicketAfterSign.setParamName(ConstantsUtil.ConfigName.PRINT_TICKET_AFTER_SIGN.getKey());
                printTicketAfterSign.setMemo("【报到成功后，可根据终端类型、检查类别、病人来源自动打印报到凭条】printTicketTerminalType：表示报到凭条终端类型；printTicketExamClass：表示报到凭条检查类别；printTicketPatientSource：表示报到凭条病人来源；");
                if (StringUtils.isNotBlank(dto.getPrintTicketAfterSign())) {
                    List<String> printTicketAfterSignList = (List<String>) CommonUtil.split2List(dto.getPrintTicketAfterSign());
                    if (!printTicketAfterSignList.isEmpty()) {
                        List<ConfigDto.PrintTicketAfterSign> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSign>();
                        for (String printTicket : printTicketAfterSignList) {
                            ConfigDto.PrintTicketAfterSign ticket = new ConfigDto.PrintTicketAfterSign();
                            String[] arr2 = printTicket.split("=");
                            String printTicketTerminalType = (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? arr2[0] : "";
                            List<String> printTicketExamClassList = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? Arrays.asList(arr2[1].split("_")) : new ArrayList<String>();
                            List<String> printTicketPatientSourceList = (StringUtils.isNotBlank(arr2[2]) && !"空".equals(arr2[2])) ? Arrays.asList(arr2[2].split("_")) : new ArrayList<String>();
                            ticket.setPrintTicketTerminalType(printTicketTerminalType);
                            ticket.setPrintTicketExamClass(printTicketExamClassList);
                            ticket.setPrintTicketPatientSource(printTicketPatientSourceList);
                            ticketList.add(ticket);
                        }
                        printTicketAfterSign.setParamValue(JsonUtil.toJson(ticketList));
                    }
                }
                sysparamsList.add(printTicketAfterSign);
            }*/
            /* 报到凭条设置-报到成功后是否提醒打印凭条
            if (dto.getRemindPrintTicketAfterSign() != null) {
                DictSysparams remindPrintTicketAfterSign = new DictSysparams();
                remindPrintTicketAfterSign.setParamName(ConstantsUtil.ConfigName.REMIND_PRINT_TICKET_AFTER_SIGN.getKey());
                remindPrintTicketAfterSign.setMemo("【报到成功后，可根据终端类型、检查类别、病人来源提醒是否要打印凭条】printTicketTerminalType：表示报到凭条终端类型；printTicketExamClass：表示报到凭条检查类别；printTicketPatientSource：表示报到凭条病人来源；");
                if (StringUtils.isNotBlank(dto.getRemindPrintTicketAfterSign())) {
                    List<String> remindPrintTicketAfterSignList = (List<String>) CommonUtil.split2List(dto.getRemindPrintTicketAfterSign());
                    if (!remindPrintTicketAfterSignList.isEmpty()) {
                        List<ConfigDto.PrintTicketAfterSign> ticketList = new ArrayList<ConfigDto.PrintTicketAfterSign>();
                        for (String remindPrintTicket : remindPrintTicketAfterSignList) {
                            ConfigDto.PrintTicketAfterSign ticket = new ConfigDto.PrintTicketAfterSign();
                            String[] arr2 = remindPrintTicket.split("=");
                            String printTicketTerminalType = (StringUtils.isNotBlank(arr2[0]) && !"空".equals(arr2[0])) ? arr2[0] : "";
                            List<String> printTicketExamClassList = (StringUtils.isNotBlank(arr2[1]) && !"空".equals(arr2[1])) ? Arrays.asList(arr2[1].split("_")) : new ArrayList<String>();
                            List<String> printTicketPatientSourceList = (StringUtils.isNotBlank(arr2[2]) && !"空".equals(arr2[2])) ? Arrays.asList(arr2[2].split("_")) : new ArrayList<String>();
                            ticket.setPrintTicketTerminalType(printTicketTerminalType);
                            ticket.setPrintTicketExamClass(printTicketExamClassList);
                            ticket.setPrintTicketPatientSource(printTicketPatientSourceList);
                            ticketList.add(ticket);
                        }
                        remindPrintTicketAfterSign.setParamValue(JsonUtil.toJson(ticketList));
                    }
                }
                sysparamsList.add(remindPrintTicketAfterSign);
            }*/

            /* 提前检查释放号源
            if (dto.getFreeSourceByEarlySign() != null) {
                DictSysparams freeSourceByEarlySign = new DictSysparams();
                freeSourceByEarlySign.setParamName(ConstantsUtil.ConfigName.FREE_SOURCE_BY_EARLY_SIGN.getKey());
                freeSourceByEarlySign.setMemo("【号源提前释放（预约系统的数据被提前登记或报到检查）】examClass：表示提前报到释放号源的检查类别；leadTime：表示提前时间（界面选什么，就怎样去存进数据库）；");
                if (StringUtils.isNotBlank(dto.getFreeSourceByEarlySign())) {
                    List<String> freeSourceByEarlySignList = (List<String>) CommonUtil.split2List(dto.getFreeSourceByEarlySign());
                    if (!freeSourceByEarlySignList.isEmpty()) {
                        List<ConfigDto.FreeSourceByEarlySign> freeSourceList = new ArrayList<ConfigDto.FreeSourceByEarlySign>();
                        for (String freeSourceByEarlySignStr : freeSourceByEarlySignList) {
                            ConfigDto.FreeSourceByEarlySign freeSource = new ConfigDto.FreeSourceByEarlySign();
                            String[] arr2 = freeSourceByEarlySignStr.split("=");
                            List<String> examClassList = StringUtils.isNotBlank(arr2[0]) ? Arrays.asList(arr2[0].split("_")) : new ArrayList<String>();
                            freeSource.setExamClass(examClassList);
                            freeSource.setLeadTime(StringUtils.isNotBlank(arr2[1]) ? arr2[1] : "");
                            freeSourceList.add(freeSource);
                        }
                        freeSourceByEarlySign.setParamValue(JsonUtil.toJson(freeSourceList));
                    }
                }
                sysparamsList.add(freeSourceByEarlySign);
            }*/

            if (dto.getIsScheduleTodayBySign() != null) {
                DictSysparams isScheduleTodayBySign = new DictSysparams();
                isScheduleTodayBySign.setParamName(ConstantsUtil.ConfigName.IS_SCHEDULE_TODAY_BY_SIGN.getKey());
                isScheduleTodayBySign.setMemo("【预约当天立即报到提示】(1：关闭   0：启用)，isScheduleApmTodayBySign：表示是否启用根据可报到时间范围弹出提示；isConfirmSignByIgnoreDialog：表示是否启用跳过预约当天立即报到弹窗，直接报到");
                if (StringUtils.isNotBlank(dto.getIsScheduleTodayBySign())) {
                    ConfigDto.ScheduleTodayBySign scheduleTodayBySign = new ConfigDto.ScheduleTodayBySign();
                    scheduleTodayBySign.setGrant(dto.getIsScheduleTodayBySign());
                    scheduleTodayBySign.setIsScheduleApmTodayBySign(configVal(dto.getIsScheduleApmTodayBySign(), "1"));
                    scheduleTodayBySign.setIsConfirmSignByIgnoreDialog(configVal(dto.getIsConfirmSignByIgnoreDialog(), "1"));
                    isScheduleTodayBySign.setParamValue(JsonUtil.toJson(scheduleTodayBySign));
                }
                sysparamsList.add(isScheduleTodayBySign);
            }
            if (dto.getIsShowInfoDialogBySign() != null) {
                DictSysparams isShowInfoDialogBySign = new DictSysparams();
                isShowInfoDialogBySign.setParamName(ConstantsUtil.ConfigName.IS_SHOW_INFO_DIALOG_BY_SIGN.getKey());
                isShowInfoDialogBySign.setParamValue(configVal(dto.getIsShowInfoDialogBySign(), "1"));
                isShowInfoDialogBySign.setMemo("【报到后弹出预约报到信息】(1：关闭   0：启用)");
                sysparamsList.add(isShowInfoDialogBySign);
            }
            if (dto.getIsAdvanceTimeForNightSign() != null) {
                DictSysparams isAdvanceTimeForNightSign = new DictSysparams();
                isAdvanceTimeForNightSign.setParamName(ConstantsUtil.ConfigName.IS_ADVANCE_TIME_FOR_NIGHT_SIGN.getKey());
                isAdvanceTimeForNightSign.setMemo("【预约凌晨（00:00~03:00）的可提前报到时间】(1：关闭   0：启用)，advanceHour：表示可提前报到小时数");
                if (StringUtils.isNotBlank(dto.getIsAdvanceTimeForNightSign())) {
                    ConfigDto.AdvanceTimeForNightSign advanceTimeForNightSign = new ConfigDto.AdvanceTimeForNightSign();
                    advanceTimeForNightSign.setGrant(dto.getIsAdvanceTimeForNightSign());
                    advanceTimeForNightSign.setAdvanceHour((dto.getAdvanceHour() != null) ? dto.getAdvanceHour() : 0);
                    isAdvanceTimeForNightSign.setParamValue(JsonUtil.toJson(advanceTimeForNightSign));
                }
                sysparamsList.add(isAdvanceTimeForNightSign);
            }
            if (dto.getIsRecedeCostByReSet() != null) {
                DictSysparams isRecedeCostByReSet = new DictSysparams();
                isRecedeCostByReSet.setParamName(ConstantsUtil.ConfigName.IS_RECEDE_COST_BY_RESET.getKey());
                isRecedeCostByReSet.setMemo("【是否启用取消报到调用退费接口】(1：关闭   0：启用)，recedeCostUrl：表示第三方退费接口的链接地址");
                if (StringUtils.isNotBlank(dto.getIsRecedeCostByReSet())) {
                    ConfigDto.RecedeCostByReSet recedeCostByReSet = new ConfigDto.RecedeCostByReSet();
                    recedeCostByReSet.setGrant(dto.getIsRecedeCostByReSet());
                    recedeCostByReSet.setRecedeCostUrl(dto.getRecedeCostUrlByReSet());
                    isRecedeCostByReSet.setParamValue(JsonUtil.toJson(recedeCostByReSet));
                }
                sysparamsList.add(isRecedeCostByReSet);
            }
            if (dto.getNoClickSignBtnByExamClass() != null) {
                DictSysparams noClickSignBtnByExamClass = new DictSysparams();
                noClickSignBtnByExamClass.setParamName(ConstantsUtil.ConfigName.NO_CLICK_SIGN_BTN_BY_EXAM_CLASS.getKey());
                noClickSignBtnByExamClass.setMemo("【根据检查类别设置报到按钮不可点击】(多个用英文逗号“,”分隔)");
                noClickSignBtnByExamClass.setParamValue(dto.getNoClickSignBtnByExamClass());
                sysparamsList.add(noClickSignBtnByExamClass);
            }
            if (dto.getRepeatSignByExamClass() != null) {
                DictSysparams repeatSignByExamClass = new DictSysparams();
                repeatSignByExamClass.setParamName(ConstantsUtil.ConfigName.REPEAT_SIGN_BY_EXAM_CLASS.getKey());
                repeatSignByExamClass.setMemo("【允许重复报到取号的类别】(多个用英文逗号“,”分隔)");
                repeatSignByExamClass.setParamValue(dto.getRepeatSignByExamClass());
                sysparamsList.add(repeatSignByExamClass);
            }
            if (dto.getIsConfirmFeeBeforeSign() != null) {
                DictSysparams isConfirmFeeBeforeSign = new DictSysparams();
                isConfirmFeeBeforeSign.setParamName(ConstantsUtil.ConfigName.IS_CONFIRM_FEE_BEFORE_SIGN.getKey());
                isConfirmFeeBeforeSign.setMemo("【是否启用报到时判断确费】（1：关闭   0：启用）");
                isConfirmFeeBeforeSign.setParamValue(dto.getIsConfirmFeeBeforeSign());
                sysparamsList.add(isConfirmFeeBeforeSign);
            }
            if (dto.getConfirmFeeBeforeSignUrl() != null) {
                DictSysparams confirmFeeBeforeSignUrl = new DictSysparams();
                confirmFeeBeforeSignUrl.setParamName(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_URL.getKey());
                confirmFeeBeforeSignUrl.setMemo("【报到时调用确费链接】注：使用的前提是[yy_isConfirmFeeBeforeSign]该配置项要启用！");
                confirmFeeBeforeSignUrl.setParamValue(dto.getConfirmFeeBeforeSignUrl());
                sysparamsList.add(confirmFeeBeforeSignUrl);
            }
            if (dto.getConfirmFeeBeforeSignExamClass() != null) {
                DictSysparams confirmFeeBeforeSignExamClass = new DictSysparams();
                confirmFeeBeforeSignExamClass.setParamName(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_EXAM_CLASS.getKey());
                confirmFeeBeforeSignExamClass.setMemo("【根据检查类别报到时确费】注：使用的前提是[yy_isConfirmFeeBeforeSign]该配置项要启用！");
                confirmFeeBeforeSignExamClass.setParamValue(dto.getConfirmFeeBeforeSignExamClass());
                sysparamsList.add(confirmFeeBeforeSignExamClass);
            }
            if (dto.getConfirmFeeBeforeSignPatientSource() != null) {
                DictSysparams confirmFeeBeforeSignPatientSource = new DictSysparams();
                confirmFeeBeforeSignPatientSource.setParamName(ConstantsUtil.ConfigName.CONFIRM_FEE_BEFORE_SIGN_PATIENT_SOURCE.getKey());
                confirmFeeBeforeSignPatientSource.setMemo("【根据病人来源报到时确费】注：使用的前提是[yy_isConfirmFeeBeforeSign]该配置项要启用！");
                confirmFeeBeforeSignPatientSource.setParamValue(dto.getConfirmFeeBeforeSignPatientSource());
                sysparamsList.add(confirmFeeBeforeSignPatientSource);
            }
            if (dto.getIsNoChargeNoSign() != null) {
                DictSysparams isNoChargeNoSign = new DictSysparams();
                isNoChargeNoSign.setParamName(ConstantsUtil.ConfigName.IS_NO_CHARGE_NO_SIGN.getKey());
                isNoChargeNoSign.setMemo("【未缴费不能报到(程序控制或报到过程控制)】（1：关闭   0：启用）启用(程序控制)，停用(报到存储过程控制)");
                isNoChargeNoSign.setParamValue(dto.getIsNoChargeNoSign());
                sysparamsList.add(isNoChargeNoSign);
            }
            if (dto.getIsSignInTimeNoLimit() != null) {
                DictSysparams isSignInTimeNoLimit = new DictSysparams();
                isSignInTimeNoLimit.setParamName(ConstantsUtil.ConfigName.IS_SIGNIN_TIME_NO_LIMIT.getKey());
                isSignInTimeNoLimit.setMemo("【取消【最早报到时间】【最晚报到时间】【时段结束时间】对报到时间的限制】(1：关闭   0：启用)");
                isSignInTimeNoLimit.setParamValue(configVal(dto.getIsSignInTimeNoLimit(), "1"));
                sysparamsList.add(isSignInTimeNoLimit);
            }
            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    /**
     * @param dto
     * @return
     * @description 其他配置项保存
     * @author ryan.li
     * @date 2022/10/20 16:26
     */
    private JsonResult saveConfig4Other(DictSysparamsDto dto) {
        if (dto != null) {
            List<DictSysparams> sysparamsList = new ArrayList<>();

//            if (dto.getFtpConfig() != null) {
//                DictSysparams ftpConfig = new DictSysparams();
//                ftpConfig.setParamName(ConstantsUtil.ConfigName.FTP_CONFIG.getKey());
//                ftpConfig.setMemo("【高拍仪文件上传FTP配置】address：FTP服务器ip地址，port：FTP端口号");
//                if (StringUtils.isNotBlank(dto.getFtpConfig())) {
//                    ConfigDto.FtpConfig ftp = new ConfigDto.FtpConfig();
//                    String[] arr = dto.getFtpConfig().split("=");
//                    ftp.setAddress((StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? arr[0] : "127.0.0.1");
//                    ftp.setPort((StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) ? Integer.parseInt(arr[1]) : 21);
//                    ftpConfig.setParamValue(JsonUtil.toJson(ftp));
//                }
//                sysparamsList.add(ftpConfig);
//            }

//            if (dto.getIsSystemMessageBoard() != null) {
//                DictSysparams isSystemMessageBoard = new DictSysparams();
//                isSystemMessageBoard.setParamName(ConstantsUtil.ConfigName.IS_SYSTEM_MESSAGE_BOARD.getKey());
//                isSystemMessageBoard.setMemo("【预约系统底部消息栏】(1：关闭   0：启用)");
//                isSystemMessageBoard.setParamValue(configVal(dto.getIsSystemMessageBoard(), "1"));
//                sysparamsList.add(isSystemMessageBoard);
//            }
            if (dto.getIsReadCard() != null) {
                DictSysparams isReadCard = new DictSysparams();
                isReadCard.setParamName(ConstantsUtil.ConfigName.IS_READ_CARD.getKey());
                isReadCard.setMemo("【读卡】(1：关闭   0：启用)");
                isReadCard.setParamValue(configVal(dto.getIsReadCard(), "1"));
                sysparamsList.add(isReadCard);
            }
            if (dto.getDeleteExamsType() != null) {
                DictSysparams deleteExamsType = new DictSysparams();
                deleteExamsType.setParamName(ConstantsUtil.ConfigName.DELETE_EXAMS_TYPE.getKey());
                deleteExamsType.setMemo("【删除检查主表exams记录的方式】(0：修改状态为“00” 1：直接删除检查记录)");
                deleteExamsType.setParamValue(configVal(dto.getDeleteExamsType(), "0"));
                sysparamsList.add(deleteExamsType);
            }
            if (dto.getIsChargeUrl() != null) {
                DictSysparams isChargeUrl = new DictSysparams();
                isChargeUrl.setParamName(ConstantsUtil.ConfigName.IS_CHARGE_URL.getKey());
                isChargeUrl.setMemo("【缴费链接页面】(1：关闭   0：启用)，grant：是否启用缴费链接页面，chargeUrl：缴费链接地址");
                if (StringUtils.isNotBlank(dto.getIsChargeUrl())) {
                    ConfigDto.ChargeUrl chargeUrl = new ConfigDto.ChargeUrl();
                    chargeUrl.setGrant(dto.getIsChargeUrl());
                    chargeUrl.setChargeUrl(dto.getChargeUrl());
                    isChargeUrl.setParamValue(JsonUtil.toJson(chargeUrl));
                }
                sysparamsList.add(isChargeUrl);
            }
            if (dto.getPrintExeUrl() != null) {
                DictSysparams printExeUrl = new DictSysparams();
                printExeUrl.setParamName(ConstantsUtil.ConfigName.PRINT_EXE_URL.getKey());
                printExeUrl.setMemo("【打印控件exe的绝对路径url】");
                printExeUrl.setParamValue(dto.getPrintExeUrl());
                sysparamsList.add(printExeUrl);
            }
            if (dto.getDiagnosticKeyword() != null) {
                DictSysparams diagnosticKeyword = new DictSysparams();
                diagnosticKeyword.setParamName(ConstantsUtil.ConfigName.DIAGNOSTIC_KEYWORD.getKey());
                diagnosticKeyword.setMemo("【诊断关键字】主要用于维护预约规则里面的关键字模版");

                if (dto.getDiagnosticKeyword().size() > 0) {
                    diagnosticKeyword.setParamValue(JsonUtil.toJson(dto.getDiagnosticKeyword()));
                }

                /*if (StringUtils.isNotBlank(dto.getDiagnosticKeyword())) {
                    List<String> diagnosticKeywordList = CommonUtil.split2List(dto.getDiagnosticKeyword());
                    if (!diagnosticKeywordList.isEmpty()) {
                        List<ConfigDto.DiagnosticKeyword> keywordList = new ArrayList<>();
                        for (String diagnosticKeywordStr : diagnosticKeywordList) {
                            ConfigDto.DiagnosticKeyword keyword = new ConfigDto.DiagnosticKeyword();
                            String[] arr2 = diagnosticKeywordStr.split("=");
                            List<String> examClassList = StringUtils.isNotBlank(arr2[0]) ? Arrays.asList(arr2[0].split("_")) : new ArrayList<>();
                            keyword.setExamClass(examClassList);
                            List<String> wordList = StringUtils.isNotBlank(arr2[1]) ? Arrays.asList(arr2[1].split("_")) : new ArrayList<>();
                            keyword.setKeyword(wordList);
                            keywordList.add(keyword);
                        }
                        diagnosticKeyword.setParamValue(JsonUtil.toJson(keywordList));
                    }
                }*/
                sysparamsList.add(diagnosticKeyword);
            }
            if (dto.getIsPrintFlagByTerminal() != null) {
                DictSysparams dictSysparams = new DictSysparams();
                dictSysparams.setParamName(ConstantsUtil.ConfigName.IS_PRINT_FLAG_BY_TERMINAL.getKey());
                dictSysparams.setMemo("【打印标识是否区分终端显示】(0：不区分 1：区分)");
                dictSysparams.setParamValue(configVal(dto.getIsPrintFlagByTerminal(), "0"));
                sysparamsList.add(dictSysparams);
            }
            if (dto.getIsShowShieldApplyBtn() != null) {
                DictSysparams isShowShieldApplyBtn = new DictSysparams();
                isShowShieldApplyBtn.setParamName(ConstantsUtil.ConfigName.IS_SHOW_SHIELD_APPLY_BTN.getKey());
                isShowShieldApplyBtn.setMemo("【启用显示屏蔽申请单按钮(预约报到界面)】(1：关闭   0：启用)");
                isShowShieldApplyBtn.setParamValue(configVal(dto.getIsShowShieldApplyBtn(), "1"));
                sysparamsList.add(isShowShieldApplyBtn);
            }
            if (dto.getIsShowSourceEditBtn() != null) {
                DictSysparams isShowSourceEditBtn = new DictSysparams();
                isShowSourceEditBtn.setParamName(ConstantsUtil.ConfigName.IS_SHOW_SOURCE_EDIT_BTN.getKey());
                isShowSourceEditBtn.setMemo("【启用显示总号源修改按钮(号源管理界面)】(1：关闭   0：启用)");
                isShowSourceEditBtn.setParamValue(configVal(dto.getIsShowSourceEditBtn(), "1"));
                sysparamsList.add(isShowSourceEditBtn);
            }
            // 登录配置
            if (StringUtils.isNotEmpty(dto.getCustomConfig())) {
                DictSysparams sysLoginParams = new DictSysparams();
                sysLoginParams.setParamName(ConstantsUtil.ConfigName.LOGIN_CONFIG.getKey());
                sysLoginParams.setMemo(ConstantsUtil.ConfigName.LOGIN_CONFIG.getValue());
                ConfigDto.SystemLoginConfig loginConfig = JsonUtil.toBean(dto.getCustomConfig(), ConfigDto.SystemLoginConfig.class);

                sysLoginParams.setParamValue(configVal(JsonUtil.toJson(loginConfig), "{}"));
                sysparamsList.add(sysLoginParams);
            }
            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    /**
     * 保存临床相关的配置
     *
     * @param dto
     * @return
     */
    private JsonResult saveConfig4Conflict(DictSysparamsDto dto) {
        if (Objects.nonNull(dto)) {
            List<DictSysparams> sysparamsList = new ArrayList<DictSysparams>();
            if (dto.getNoConflictExamClass() != null) {
                DictSysparams noConflictExamClass = new DictSysparams();
                noConflictExamClass.setParamName(ConstantsUtil.ConfigName.NO_CONFLICT_EXAM_CLASS.getKey());
                noConflictExamClass.setMemo("【管理端预约，可约在同一时段的类别】examClass：设置不想冲突的检查类别，excepClass：与哪些预约在一起不冲突的检查类别");

                if (dto.getNoConflictExamClass() != null && dto.getNoConflictExamClass().size() > 0) {
                    noConflictExamClass.setParamValue(JsonUtil.toJson(dto.getNoConflictExamClass()));
                }

                /*if (StringUtils.isNotBlank(dto.getNoConflictExamClass())) {
                    List<String> noConflictExamClassList = (List<String>) CommonUtil.split2List(dto.getNoConflictExamClass());
                    if (!noConflictExamClassList.isEmpty()) {
                        List<ConfigDto.NoConflictExamClass> examClassList = new ArrayList<ConfigDto.NoConflictExamClass>();
                        for (String noConflictExamClassStr : noConflictExamClassList) {
                            ConfigDto.NoConflictExamClass conflict = new ConfigDto.NoConflictExamClass();
                            String[] arr = noConflictExamClassStr.split("=");
                            if (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0]) && StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) {
                                conflict.setExamClass((StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? arr[0] : "");
                                List<String> excepClassList = (StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) ? Arrays.asList(arr[1].split("_")) : new ArrayList<String>();
                                conflict.setExcepClass(excepClassList);
                                examClassList.add(conflict);
                            }
                        }
                        noConflictExamClass.setParamValue(JsonUtil.toJson(examClassList));
                    }
                }*/
                sysparamsList.add(noConflictExamClass);
            }
            if (dto.getNoConflictIntervalTime() != null) {
                DictSysparams noConflictIntervalTime = new DictSysparams();
                noConflictIntervalTime.setParamName(ConstantsUtil.ConfigName.NO_CONFLICT_INTERVAL_TIME.getKey());
                noConflictIntervalTime.setMemo("【同患者同天不同类别所约时段之间不发生冲突的时间间隔】（单位：分钟）");
                noConflictIntervalTime.setParamValue((dto.getNoConflictIntervalTime() != null) ? String.valueOf(dto.getNoConflictIntervalTime()) : "");
                sysparamsList.add(noConflictIntervalTime);
            }
            if (dto.getIsNoOneDayClamDay() != null) {
                DictSysparams isNoOneDayClamDay = new DictSysparams();
                isNoOneDayClamDay.setParamName(ConstantsUtil.ConfigName.IS_NO_ONE_DAY_CLAM.getKey());
                isNoOneDayClamDay.setMemo("【是否启用所有需要镇静的项目不能同一天检查】（1：关闭   0：启用）");
                isNoOneDayClamDay.setParamValue(configVal(dto.getIsNoOneDayClamDay(), "1"));
                sysparamsList.add(isNoOneDayClamDay);
            }
            if (dto.getIsNoOneDayEnhance() != null) {
                DictSysparams isNoOneDayEnhance = new DictSysparams();
                isNoOneDayEnhance.setParamName(ConstantsUtil.ConfigName.IS_NO_ONE_DAY_ENHANCE.getKey());
                isNoOneDayEnhance.setMemo("【是否启用所有需要增强的项目不能同一天检查】（1：关闭   0：启用）");
                isNoOneDayEnhance.setParamValue(configVal(dto.getIsNoOneDayEnhance(), "1"));
                sysparamsList.add(isNoOneDayEnhance);
            }
            if (dto.getNoOneDayClamOrEnhanceItem() != null) {
                DictSysparams noOneDayClamOrEnhanceItem = new DictSysparams();
                noOneDayClamOrEnhanceItem.setParamName(ConstantsUtil.ConfigName.NO_ONE_DAY_CLAM_OR_ENHANCE_ITEM.getKey());
                noOneDayClamOrEnhanceItem.setMemo("【不能和镇静/增强同一天检查的项目】itemFlag：项目属性（0：该项目不允许预约 1：镇静要求  2：增强项目  3：空腹要求  4：憋尿要求  5：穿刺要求  6：不允许自助报到 7：只允许医技前台预约），examItem：不能同一天检查的项目");

                if (CollectionUtils.isNotEmpty(dto.getNoOneDayClamOrEnhanceItem())) {
                    // 验证参数设置是否合理
                    for (ConfigDto.NoOneDayClamOrEnhanceItem enhanceItem : dto.getNoOneDayClamOrEnhanceItem()) {
                        if ("1".equals(enhanceItem.getItemFlag()) && CollectionUtils.isEmpty(enhanceItem.getExamItem())) {
                            throw new BusinessException("【不能和镇静/增强同一天检查的项目】已启用,但是没有设置具体的项目!");
                        }
                    }
                    noOneDayClamOrEnhanceItem.setParamValue(JsonUtil.toJson(dto.getNoOneDayClamOrEnhanceItem()));
                }

                /*if (StringUtils.isNotBlank(dto.getNoOneDayClamOrEnhanceItem())) {
                    List<String> noOneDayClamOrEnhanceItemList = (List<String>) CommonUtil.split2List(dto.getNoOneDayClamOrEnhanceItem());
                    if (!noOneDayClamOrEnhanceItemList.isEmpty()) {
                        List<ConfigDto.NoOneDayClamOrEnhanceItem> clamOrEnhanceItemList = new ArrayList<ConfigDto.NoOneDayClamOrEnhanceItem>();
                        for (String clamOrEnhanceItemStr : noOneDayClamOrEnhanceItemList) {
                            ConfigDto.NoOneDayClamOrEnhanceItem clamOrEnhanceItem = new ConfigDto.NoOneDayClamOrEnhanceItem();
                            String[] arr = clamOrEnhanceItemStr.split("\\|\\|");
                            clamOrEnhanceItem.setItemFlag(StringUtils.isNotBlank(arr[0]) ? arr[0] : "");
                            if (StringUtils.isNotBlank(arr[1])) {
                                List<String> itemList = Arrays.asList(arr[1].split("_"));
                                if (!itemList.isEmpty()) {
                                    List<DictExamItem> dictExamItemList = new ArrayList<DictExamItem>();
                                    for (String itemStr : itemList) {
                                        DictExamItem dictExamItem = new DictExamItem();
                                        String[] itemArr = itemStr.split("=");
                                        dictExamItem.setExamClass(StringUtils.isNotBlank(itemArr[0]) ? itemArr[0] : "");
                                        dictExamItem.setItemCode(StringUtils.isNotBlank(itemArr[1]) ? itemArr[1] : "");
                                        dictExamItem.setItemName(StringUtils.isNotBlank(itemArr[2]) ? itemArr[2] : "");
                                        dictExamItemList.add(dictExamItem);
                                    }
                                    clamOrEnhanceItem.setExamItem(dictExamItemList);
                                }
                            }
                            clamOrEnhanceItemList.add(clamOrEnhanceItem);
                        }
                        noOneDayClamOrEnhanceItem.setParamValue(JsonUtil.toJson(clamOrEnhanceItemList));
                    }
                }*/
                sysparamsList.add(noOneDayClamOrEnhanceItem);
            }
            if (dto.getOneDayOrder() != null) {
                DictSysparams oneDayOrder = new DictSysparams();
                oneDayOrder.setParamName(ConstantsUtil.ConfigName.ONE_DAY_ORDER.getKey());
                oneDayOrder.setMemo("【预约在同一天时的项目预约次序】");

                if (dto.getOneDayOrder() != null && dto.getOneDayOrder().size() > 0) {
                    oneDayOrder.setParamValue(JsonUtil.toJson(dto.getOneDayOrder()));
                }

                /*if (StringUtils.isNotBlank(dto.getOneDayOrder())) {
                    List<String> oneDayOrderList = (List<String>) CommonUtil.split2List(dto.getOneDayOrder());
                    if (!oneDayOrderList.isEmpty()) {
                        List<ConfigDto.OneDayOrder> orderList = new ArrayList<ConfigDto.OneDayOrder>();
                        for (String oneDayOrderStr : oneDayOrderList) {
                            List<String> itemList2 = Arrays.asList(oneDayOrderStr.split("_"));
                            ConfigDto.OneDayOrder order = new ConfigDto.OneDayOrder();
                            if (!itemList2.isEmpty()) {
                                List<DictExamItem> dictExamItemList2 = new ArrayList<DictExamItem>();
                                for (String itemStr2 : itemList2) {
                                    DictExamItem dictExamItem2 = new DictExamItem();
                                    String[] itemArr2 = itemStr2.split("=");
                                    dictExamItem2.setExamClass(StringUtils.isNotBlank(itemArr2[0]) ? itemArr2[0] : "");
                                    dictExamItem2.setItemCode(StringUtils.isNotBlank(itemArr2[1]) ? itemArr2[1] : "");
                                    dictExamItem2.setItemName(StringUtils.isNotBlank(itemArr2[2]) ? itemArr2[2] : "");
                                    dictExamItemList2.add(dictExamItem2);
                                }
                                order.setExamItem(dictExamItemList2);
                            }
                            orderList.add(order);
                        }
                        oneDayOrder.setParamValue(JsonUtil.toJson(orderList));
                    }
                }*/
                sysparamsList.add(oneDayOrder);
            }
            if (dto.getItemBefore() != null) {
                DictSysparams itemBefore = new DictSysparams();
                itemBefore.setParamName(ConstantsUtil.ConfigName.ITEM_BEFORE.getKey());
                itemBefore.setMemo("【A列表项目比B列表项目至少优先或延后多少天多少小时（项目先后检查及时间设置）】beforeDays：提前多少天数，beforeHours：提前多少小时，afterDays：延后多少天数，afterHours：延后多少小时，examItemA：A列表，examItemB：B列表");

                if (dto.getItemBefore() != null && dto.getItemBefore().size() > 0) {
                    itemBefore.setParamValue(JsonUtil.toJson(dto.getItemBefore()));
                }

                /*if (StringUtils.isNotBlank(dto.getItemBefore())) {
                    List<String> itemBeforeList = CommonUtil.split2List(dto.getItemBefore());
                    if (!itemBeforeList.isEmpty()) {
                        List<ConfigDto.ItemBefore> itemBeforeSetList = new ArrayList<ConfigDto.ItemBefore>();
                        for (String itemBeforeStr : itemBeforeList) {
                            ConfigDto.ItemBefore itemBeforeSet = new ConfigDto.ItemBefore();
                            String[] arr = itemBeforeStr.split("\\|\\|");
                            if ((StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) || (StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) || (StringUtils.isNotBlank(arr[2]) && !"空".equals(arr[2])) || (StringUtils.isNotBlank(arr[3]) && !"空".equals(arr[3])) || (StringUtils.isNotBlank(arr[4]) && !"空".equals(arr[4])) || (StringUtils.isNotBlank(arr[5]) && !"空".equals(arr[5]))) {
                                itemBeforeSet.setBeforeDays((StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? Integer.valueOf(Integer.parseInt(arr[0])) : null);
                                itemBeforeSet.setBeforeHours((StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) ? Integer.valueOf(Integer.parseInt(arr[1])) : null);
                                itemBeforeSet.setAfterDays((StringUtils.isNotBlank(arr[2]) && !"空".equals(arr[2])) ? Integer.valueOf(Integer.parseInt(arr[2])) : null);
                                itemBeforeSet.setAfterHours((StringUtils.isNotBlank(arr[3]) && !"空".equals(arr[3])) ? Integer.valueOf(Integer.parseInt(arr[3])) : null);
                                if (StringUtils.isNotBlank(arr[4]) && !"空".equals(arr[4])) {
                                    List<String> itemListA = Arrays.asList(arr[4].split("_"));
                                    if (!itemListA.isEmpty()) {
                                        List<DictExamItem> dictExamItemListA = new ArrayList<DictExamItem>();
                                        for (String itemA : itemListA) {
                                            DictExamItem dictExamItemA = new DictExamItem();
                                            String[] itemArrA = itemA.split("=");
                                            dictExamItemA.setExamClass(StringUtils.isNotBlank(itemArrA[0]) ? itemArrA[0] : "");
                                            dictExamItemA.setItemCode(StringUtils.isNotBlank(itemArrA[1]) ? itemArrA[1] : "");
                                            dictExamItemA.setItemName(StringUtils.isNotBlank(itemArrA[2]) ? itemArrA[2] : "");
                                            dictExamItemListA.add(dictExamItemA);
                                        }
                                        itemBeforeSet.setExamItemA(dictExamItemListA);
                                    }
                                }
                                if (StringUtils.isNotBlank(arr[5]) && !"空".equals(arr[5])) {
                                    List<String> itemListB = Arrays.asList(arr[5].split("_"));
                                    if (!itemListB.isEmpty()) {
                                        List<DictExamItem> dictExamItemListB = new ArrayList<DictExamItem>();
                                        for (String itemB : itemListB) {
                                            DictExamItem dictExamItemB = new DictExamItem();
                                            String[] itemArrB = itemB.split("=");
                                            dictExamItemB.setExamClass(StringUtils.isNotBlank(itemArrB[0]) ? itemArrB[0] : "");
                                            dictExamItemB.setItemCode(StringUtils.isNotBlank(itemArrB[1]) ? itemArrB[1] : "");
                                            dictExamItemB.setItemName(StringUtils.isNotBlank(itemArrB[2]) ? itemArrB[2] : "");
                                            dictExamItemListB.add(dictExamItemB);
                                        }
                                        itemBeforeSet.setExamItemB(dictExamItemListB);
                                    }
                                }
                                itemBeforeSetList.add(itemBeforeSet);
                            }
                        }
                        itemBefore.setParamValue(JsonUtil.toJson(itemBeforeSetList));
                    }
                }*/
                sysparamsList.add(itemBefore);
            }
            if (dto.getIsNotAllowScheduleByConflict() != null) {
                DictSysparams isNotAllowScheduleByConflict = new DictSysparams();
                isNotAllowScheduleByConflict.setParamName(ConstantsUtil.ConfigName.IS_NOT_ALLOW_SCHEDULE_BY_CONFLICT.getKey());
                isNotAllowScheduleByConflict.setMemo("【是否启用预约冲突后不允许“继续预约”】（1：关闭   0：启用）");
                isNotAllowScheduleByConflict.setParamValue(configVal(dto.getIsNotAllowScheduleByConflict(), "1"));
                sysparamsList.add(isNotAllowScheduleByConflict);
            }
            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    private JsonResult saveConfig4Interface(DictSysparamsDto dto) {
        if (dto != null) {
            List<DictSysparams> sysparamsList = new ArrayList<>();
            if (dto.getRemainSourceType() != null) {
                DictSysparams remainSourceType = new DictSysparams();
                remainSourceType.setParamName(ConstantsUtil.ConfigName.REMAIN_SOURCE_TYPE.getKey());
                remainSourceType.setMemo("【时段剩余号源】0：显示为时段总剩余号源；1：显示为数量规则计算后实际剩余的号源");
                remainSourceType.setParamValue(configVal(dto.getRemainSourceType(), "0"));
                sysparamsList.add(remainSourceType);
            }
            if (dto.getFontColor() != null) {
                DictSysparams fontColor = new DictSysparams();
                fontColor.setParamName(ConstantsUtil.ConfigName.FONT_COLOR.getKey());
                fontColor.setMemo("【字体颜色】采用十六进制颜色值");
                fontColor.setParamValue(configVal(dto.getFontColor(), ""));
                sysparamsList.add(fontColor);
            }
            if (dto.getStatisticalAnalysisEntry() != null) {
                DictSysparams statisticalAnalysisEntry = new DictSysparams();
                statisticalAnalysisEntry.setParamName(ConstantsUtil.ConfigName.STATISTICAL_ANALYSIS_ENTRY.getKey());
                statisticalAnalysisEntry.setMemo("【统计分析入口】menuName：菜单入口名称；menuUrl：链接地址；examClass：检查类别；");
                dto.getStatisticalAnalysisEntry().removeIf(menuSet -> StringUtils.isBlank(menuSet.getMenuName()) || StringUtils.isBlank(menuSet.getMenuUrl()) || menuSet.getExamClass() == null || menuSet.getExamClass().isEmpty());
                statisticalAnalysisEntry.setParamValue(JsonUtil.toJson(dto.getStatisticalAnalysisEntry()));
                sysparamsList.add(statisticalAnalysisEntry);
            }
            if (dto.getNoScheduleItemReminder() != null) {
                DictSysparams noScheduleItemReminder = new DictSysparams();
                noScheduleItemReminder.setParamName(ConstantsUtil.ConfigName.NO_SCHEDULE_ITEM_REMINDER.getKey());
                noScheduleItemReminder.setMemo("【不预约的项目(自定义提示语)】");
                noScheduleItemReminder.setParamValue(configVal(dto.getNoScheduleItemReminder(), ""));
                sysparamsList.add(noScheduleItemReminder);
            }
            if (dto.getNoQueryExamApplyReminder() != null) {
                DictSysparams noQueryExamApplyReminder = new DictSysparams();
                noQueryExamApplyReminder.setParamName(ConstantsUtil.ConfigName.NO_QUERY_EXAM_APPLY_REMINDER.getKey());
                noQueryExamApplyReminder.setMemo("【未查询的申请单(自定义提示语)】");
                noQueryExamApplyReminder.setParamValue(configVal(dto.getNoQueryExamApplyReminder(), ""));
                sysparamsList.add(noQueryExamApplyReminder);
            }
            if (dto.getNoQueueByExamClassReminder() != null) {
                DictSysparams noQueueByExamClassReminder = new DictSysparams();
                noQueueByExamClassReminder.setParamName(ConstantsUtil.ConfigName.NO_QUEUE_BY_EXAM_CLASS_REMINDER.getKey());
                noQueueByExamClassReminder.setMemo("【检查类别下无队列(自定义提示语)】");
                noQueueByExamClassReminder.setParamValue(configVal(dto.getNoQueueByExamClassReminder(), ""));
                sysparamsList.add(noQueueByExamClassReminder);
            }
            if (dto.getNotAllowEditOrCancelBeforeScheduleReminder() != null) {
                DictSysparams notAllowEditOrCancelBeforeScheduleReminder = new DictSysparams();
                notAllowEditOrCancelBeforeScheduleReminder.setParamName(ConstantsUtil.ConfigName.NOT_ALLOW_EDIT_OR_CANCEL_BEFORE_SCHEDULE_REMINDER.getKey());
                notAllowEditOrCancelBeforeScheduleReminder.setMemo("【限制预约前一定时间不允许修改和取消预约(自定义提示语)】");
                notAllowEditOrCancelBeforeScheduleReminder.setParamValue(configVal(dto.getNotAllowEditOrCancelBeforeScheduleReminder(), ""));
                sysparamsList.add(notAllowEditOrCancelBeforeScheduleReminder);
            }
            if (dto.getNoSignQueueBySelfReminder() != null) {
                DictSysparams NoSignQueueBySelfReminder = new DictSysparams();
                NoSignQueueBySelfReminder.setParamName(ConstantsUtil.ConfigName.NO_SIGN_QUEUE_BY_SELF_REMINDER.getKey());
                NoSignQueueBySelfReminder.setMemo("【自助机不报到的队列(自定义提示语)】");
                NoSignQueueBySelfReminder.setParamValue(StringUtils.isNotBlank(dto.getNoSignQueueBySelfReminder()) ? dto.getNoSignQueueBySelfReminder() : "");
                sysparamsList.add(NoSignQueueBySelfReminder);
            }
            if (dto.getLimitScheduleItemByTerminalReminder() != null) {
                DictSysparams limitScheduleItemByTerminalReminder = new DictSysparams();
                limitScheduleItemByTerminalReminder.setParamName(ConstantsUtil.ConfigName.LIMIT_SCHEDULE_ITEM_BY_TERMINAL_REMINDER.getKey());
                limitScheduleItemByTerminalReminder.setMemo("【限制预约终端项目(自定义提示语)】");
                limitScheduleItemByTerminalReminder.setParamValue(configVal(dto.getLimitScheduleItemByTerminalReminder(), ""));
                sysparamsList.add(limitScheduleItemByTerminalReminder);
            }
            if (dto.getLoginLogoPic() != null) {
                DictSysparams loginLogoPic = new DictSysparams();
                loginLogoPic.setParamName(ConstantsUtil.ConfigName.LOGIN_LOGO_PIC.getKey());
                loginLogoPic.setMemo("【登录页logo图片】数据格式为base64");
                loginLogoPic.setParamValue(configVal(dto.getLoginLogoPic(), ""));
                sysparamsList.add(loginLogoPic);
            }
            if (dto.getFrameLogoPic() != null) {
                DictSysparams frameLogoPic = new DictSysparams();
                frameLogoPic.setParamName(ConstantsUtil.ConfigName.FRAME_LOGO_PIC.getKey());
                frameLogoPic.setMemo("【框架栏logo图片】数据格式为base64");
                frameLogoPic.setParamValue(configVal(dto.getFrameLogoPic(), ""));
                sysparamsList.add(frameLogoPic);
            }
            if (dto.getFrameName() != null) {
                DictSysparams frameName = new DictSysparams();
                frameName.setParamName(ConstantsUtil.ConfigName.FRAME_NAME.getKey());
                frameName.setMemo("【机构文字名称】");
                frameName.setParamValue(dto.getFrameName());
                sysparamsList.add(frameName);
            }
            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    private JsonResult saveConfig4SearchesForm(DictSysparamsDto dto) {
        if (dto != null) {
            List<DictSysparams> sysparamsList = new ArrayList<>();
            // 综合查询-打印清单
            if (Objects.nonNull(dto.getPrintList())) {
                DictSysparams printList = new DictSysparams();
                printList.setParamName(ConstantsUtil.ConfigName.YY_PRINT_LIST.getKey());
                printList.setMemo("【打印清单】姓名:name,性别:sex,年龄:age,检查项目:itemName,申请时间:reqDate,预约时间:scheduleDate,病人ID:sickId,床号:bedNo,护理单元:nurseUnit,病人来源:patientSource,申请科室:reqDeptName,申请单号:applyNo,申请医生:reqPhysician,电话:phoneNumber,检查类别:examClass,预约队列:queueName,门诊号:outpatientNo,申请病区:reqWardName,优先级别:priorityOrder,运送工具:transTool,是否陪检:accomExam");
                printList.setParamValue(JsonUtil.toJson(dto.getPrintList()));
                sysparamsList.add(printList);
            }
            if (dto.getPrintListSortSet() != null) {
                DictSysparams printListSortSet = new DictSysparams();
                printListSortSet.setParamName(ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET.getKey());
                printListSortSet.setMemo("【打印清单排序设置】paperWidth：纸张宽度，sortField：排序字段(0:预约时间 1:申请时间 2:排队号 3:床号)，sortOrder：排序方式(asc、desc)，fontSize：字号，title：清单标题，intOrient：纸张打印方向");
                printListSortSet.setParamValue(JsonUtil.toJson(dto.getPrintListSortSet()));
                sysparamsList.add(printListSortSet);
            }
            if (dto.getCustomExcel() != null) {
                DictSysparams customExcel = new DictSysparams();
                customExcel.setParamName(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL.getKey());
                customExcel.setMemo("【导出清单】姓名:name,性别:sex,年龄:age,检查项目:itemName,申请时间:reqDate,预约时间:scheduleDate,病人ID:sickId,床号:bedNo,护理单元:nurseUnit,病人来源:patientSource,申请科室:reqDeptName,申请单号:applyNo,申请医生:reqPhysician,电话:phoneNumber,检查类别:examClass,预约队列:queueName,门诊号:outpatientNo,申请病区:reqWardName,优先级别:priorityOrder,运送工具:transTool,是否陪检:accomExam");
                customExcel.setParamValue(JsonUtil.toJson(dto.getCustomExcel()));
                sysparamsList.add(customExcel);
            }
            if (dto.getCustomExcelSortSet() != null) {
                DictSysparams customExcelSortSet = new DictSysparams();
                customExcelSortSet.setParamName(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET.getKey());
                customExcelSortSet.setMemo("【导出清单排序设置】paperWidth：列宽度，sortField：排序字段(0:预约时间 1:申请时间 2:排队号 3:床号)，sortOrder：排序方式(asc、desc)，fontSize：字号，title：清单标题");
                customExcelSortSet.setParamValue(JsonUtil.toJson(dto.getCustomExcelSortSet()));
                sysparamsList.add(customExcelSortSet);
            }
            if (dto.getCustomSearchToolByMultipleQuery() != null) {
                DictSysparams customSearchToolByMultipleQuery = new DictSysparams();
                customSearchToolByMultipleQuery.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_MULTIPLE_QUERY.getKey());
                customSearchToolByMultipleQuery.setMemo("【自定义检索栏（综合查询界面）】columnName：界面显示名称；mateName：匹配名（固定写死）；");
                customSearchToolByMultipleQuery.setParamValue(JsonUtil.toJson(dto.getCustomSearchToolByMultipleQuery()));
                sysparamsList.add(customSearchToolByMultipleQuery);
            }
            if (dto.getCustomTableRowByMultipleQuery() != null) {
                DictSysparams customTableRowByMultipleQuery = new DictSysparams();
                customTableRowByMultipleQuery.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_MULTIPLE_QUERY.getKey());
                customTableRowByMultipleQuery.setMemo("【自定义表格列（综合查询界面）】columnName：界面显示名称；mateName：匹配名（固定写死）；percentage：列宽；");
                customTableRowByMultipleQuery.setParamValue(JsonUtil.toJson(dto.getCustomTableRowByMultipleQuery()));
                sysparamsList.add(customTableRowByMultipleQuery);
            }
            if (dto.getCustomTableRowSortSetByMultipleQuery() != null) {
                DictSysparams customExcelSortSetByMultipleQuery = new DictSysparams();
                customExcelSortSetByMultipleQuery.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_MULTIPLE_QUERY.getKey());
                customExcelSortSetByMultipleQuery.setMemo("【自定义列排序设置（综合查询界面）】sortField：排序字段(0:预约时间；1:申请时间；2：排队号；3：床号；4：申请单号；5：入院时间；6：检查类别；)，sortOrder：排序方式(asc、desc)");
                customExcelSortSetByMultipleQuery.setParamValue(JsonUtil.toJson(dto.getCustomTableRowSortSetByMultipleQuery()));
                sysparamsList.add(customExcelSortSetByMultipleQuery);
            }
            if (dto.getCustomTableRowByApplyInfo() != null) {
                DictSysparams customTableRowByApplyInfo = new DictSysparams();
                customTableRowByApplyInfo.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_APPLY_INFO.getKey());
                customTableRowByApplyInfo.setMemo("【自定义字段（预约报到--申请单内容）】columnName：界面显示名称；mateName：匹配名（固定写死）；");
                customTableRowByApplyInfo.setParamValue(JsonUtil.toJson(dto.getCustomTableRowByApplyInfo()));
                sysparamsList.add(customTableRowByApplyInfo);
            }
            if (dto.getCustomSearchToolByScheduleSign() != null) {
                DictSysparams customSearchToolByScheduleSign = new DictSysparams();
                customSearchToolByScheduleSign.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_SCHEDULE_SIGN.getKey());
                customSearchToolByScheduleSign.setMemo("【自定义检索栏（预约报到界面）】columnName：界面显示名称；mateName：匹配名（固定写死）；");
                customSearchToolByScheduleSign.setParamValue(JsonUtil.toJson(dto.getCustomSearchToolByScheduleSign()));
                sysparamsList.add(customSearchToolByScheduleSign);
            }
            if (dto.getIsAutoQueryByScheduleSign() != null) {
                DictSysparams isAutoQueryByScheduleSign = new DictSysparams();
                isAutoQueryByScheduleSign.setParamName(ConstantsUtil.ConfigName.IS_AUTO_QUERY_BY_SCHEDULE_SIGN.getKey());
                isAutoQueryByScheduleSign.setMemo("【是否显示自动查询(预约报到界面)】（1-隐藏；0-显示）");
                isAutoQueryByScheduleSign.setParamValue(configVal(dto.getIsAutoQueryByScheduleSign(), "1"));
                sysparamsList.add(isAutoQueryByScheduleSign);
            }
            DictSysparams autoQueryCountByScheduleSign = new DictSysparams();
            autoQueryCountByScheduleSign.setParamName(ConstantsUtil.ConfigName.AUTO_QUERY_COUNT_BY_SCHEDULE_SIGN.getKey());
            autoQueryCountByScheduleSign.setMemo("【设置默认自动查询秒数(预约报到界面)】");
            autoQueryCountByScheduleSign.setParamValue((dto.getAutoQueryCountByScheduleSign() != null) ? String.valueOf(dto.getAutoQueryCountByScheduleSign()) : "");
            sysparamsList.add(autoQueryCountByScheduleSign);
            if (dto.getCustomTableRowByScheduleSign() != null) {
                DictSysparams customTableRowByScheduleSign = new DictSysparams();
                customTableRowByScheduleSign.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_SCHEDULE_SIGN.getKey());
                customTableRowByScheduleSign.setMemo("【自定义表格列（预约报到界面）】columnName：界面显示名称；mateName：匹配名（固定写死）；percentage：列宽；");
                customTableRowByScheduleSign.setParamValue(JsonUtil.toJson(dto.getCustomTableRowByScheduleSign()));
                sysparamsList.add(customTableRowByScheduleSign);
            }
            if (dto.getCustomTableRowSortSetByScheduleSign() != null) {
                DictSysparams customExcelSortSetByScheduleSign = new DictSysparams();
                customExcelSortSetByScheduleSign.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN.getKey());
                customExcelSortSetByScheduleSign.setMemo("【自定义列排序设置（预约报到界面）】sortField：排序字段(1:申请时间；4：申请单号；5：入院时间；6：检查类别；)，sortOrder：排序方式(asc、desc)");
                customExcelSortSetByScheduleSign.setParamValue(JsonUtil.toJson(dto.getCustomTableRowSortSetByScheduleSign()));
                sysparamsList.add(customExcelSortSetByScheduleSign);
            }
            if (dto.getCustomTableRowSortSetByScheduleSignPatientList() != null) {
                DictSysparams customTableRowSortSetByScheduleSignPatientList = new DictSysparams();
                customTableRowSortSetByScheduleSignPatientList.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_SCHEDULE_SIGN_PATIENT_LIST.getKey());
                customTableRowSortSetByScheduleSignPatientList.setMemo("【自定义列排序设置(预约报到界面-患者列表)】sortField：排序字段(0:预约时间；1:申请时间；2：排队号；3：床号；4：申请单号；5：入院时间；6：检查类别；)，sortOrder：排序方式(asc、desc)");
                customTableRowSortSetByScheduleSignPatientList.setParamValue(JsonUtil.toJson(dto.getCustomTableRowSortSetByScheduleSignPatientList()));
                sysparamsList.add(customTableRowSortSetByScheduleSignPatientList);
            }
            if (dto.getCustomTableRowByScheduleDetail() != null) {
                DictSysparams customTableRowByScheduleDetail = new DictSysparams();
                customTableRowByScheduleDetail.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_SCHEDULE_DETAIL.getKey());
                customTableRowByScheduleDetail.setMemo("【自定义表格列（预约详情界面）】columnName：界面显示名称；mateName：匹配名（固定写死）；percentage：列宽；");
                customTableRowByScheduleDetail.setParamValue(JsonUtil.toJson(dto.getCustomTableRowByScheduleDetail()));
                sysparamsList.add(customTableRowByScheduleDetail);
            }
            if (dto.getCustomTableRowByOrderManage() != null) {
                DictSysparams customTableRowByOrderManage = new DictSysparams();
                customTableRowByOrderManage.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_ORDER_MANAGE.getKey());
                customTableRowByOrderManage.setMemo("【自定义表格列（号源设置界面）】columnName：界面显示名称；mateName：匹配名（固定写死）；percentage：列宽；");
                customTableRowByOrderManage.setParamValue(JsonUtil.toJson(dto.getCustomTableRowByOrderManage()));
                sysparamsList.add(customTableRowByOrderManage);
            }
            if (dto.getCustomExcelByVirtualOrder() != null) {
                DictSysparams customExcelByVirtualOrder = new DictSysparams();
                customExcelByVirtualOrder.setParamName(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_VIRTUAL_ORDER.getKey());
                customExcelByVirtualOrder.setMemo("【虚单导出清单】");
                customExcelByVirtualOrder.setParamValue(JsonUtil.toJson(dto.getCustomExcelByVirtualOrder()));
                sysparamsList.add(customExcelByVirtualOrder);
            }
            if (dto.getCustomExcelSortSetByVirtualOrder() != null) {
                DictSysparams customExcelSortSetByVirtualOrder = new DictSysparams();
                customExcelSortSetByVirtualOrder.setParamName(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_VIRTUAL_ORDER.getKey());
                customExcelSortSetByVirtualOrder.setMemo("【虚单导出清单排序设置】paperWidth：列宽度，sortField：排序字段(0:预约时间 1:申请时间 2:排队号 3:床号)，sortOrder：排序方式(asc、desc)，fontSize：字号，title：清单标题");
                customExcelSortSetByVirtualOrder.setParamValue(JsonUtil.toJson(dto.getCustomExcelSortSetByVirtualOrder()));
                sysparamsList.add(customExcelSortSetByVirtualOrder);
            }

            /*if (dto.getCureCustomExcel() != null) {
                DictSysparams cureCustomExcel = new DictSysparams();
                cureCustomExcel.setParamName(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL.getKey());
                cureCustomExcel.setMemo("【治疗导出清单】");
                cureCustomExcel.setParamValue(JsonUtil.toJson(dto.getCureCustomExcel()));
                sysparamsList.add(cureCustomExcel);
            }
            if (dto.getCureCustomExcelSortSet() != null) {
                DictSysparams cureCustomExcelSortSet = new DictSysparams();
                cureCustomExcelSortSet.setParamName(ConstantsUtil.ConfigName.YY_CURE_CUSTOMEXCEL_SORT_SET.getKey());
                cureCustomExcelSortSet.setMemo("【治疗导出清单排序设置】paperWidth：列宽度，sortField：排序字段(0:申请时间 2:床号)，sortOrder：排序方式(asc、desc)，fontSize：字号，title：清单标题");
                if (StringUtils.isNotBlank(dto.getCureCustomExcelSortSet())) {
                    String[] arr = dto.getCureCustomExcelSortSet().split("=");
                    String paperWidth = (StringUtils.isNotBlank(arr[0]) && !"空".equals(arr[0])) ? arr[0] : "";
                    String sortField = (StringUtils.isNotBlank(arr[1]) && !"空".equals(arr[1])) ? arr[1] : "";
                    String sortOrder = (StringUtils.isNotBlank(arr[2]) && !"空".equals(arr[2])) ? arr[2] : "";
                    String fontSize = (StringUtils.isNotBlank(arr[3]) && !"空".equals(arr[3])) ? arr[3] : "";
                    String sortField2 = (StringUtils.isNotBlank(arr[4]) && !"空".equals(arr[4])) ? arr[4] : "";
                    String sortOrder2 = (StringUtils.isNotBlank(arr[5]) && !"空".equals(arr[5])) ? arr[5] : "";
                    String title = (StringUtils.isNotBlank(arr[6]) && !"空".equals(arr[6])) ? arr[6] : "";
                    ConfigDto.SortSet sortSet = new ConfigDto.SortSet();
                    sortSet.setPaperWidth(paperWidth);
                    sortSet.setSortField(sortField);
                    sortSet.setSortOrder(sortOrder);
                    sortSet.setFontSize(fontSize);
                    sortSet.setSortField2(sortField2);
                    sortSet.setSortOrder2(sortOrder2);
                    sortSet.setTitle(title);
                    cureCustomExcelSortSet.setParamValue(JsonUtil.toJson(sortSet));
                }
                sysparamsList.add(cureCustomExcelSortSet);
            }*/

            /*if (dto.getCustomSearchToolByClinicsche() != null) {
                DictSysparams customSearchToolByClinicsche = new DictSysparams();
                customSearchToolByClinicsche.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_CLINICSCHE.getKey());
                customSearchToolByClinicsche.setMemo("【自定义检索栏(临床预约-预约报到界面)】columnName：界面显示名称；mateName：匹配名（固定写死）；");
                customSearchToolByClinicsche.setParamValue(JsonUtil.toJson(dto.getCustomSearchToolByClinicsche()));
                sysparamsList.add(customSearchToolByClinicsche);
            }
            if (dto.getCustomTableRowByClinicsche() != null) {
                DictSysparams customTableRowByClinicsche = new DictSysparams();
                customTableRowByClinicsche.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_CLINICSCHE.getKey());
                customTableRowByClinicsche.setMemo("【自定义表格列(临床预约-预约报到界面)】columnName：界面显示名称；mateName：匹配名（固定写死）；percentage：列宽；");
                customTableRowByClinicsche.setParamValue(JsonUtil.toJson(dto.getCustomTableRowByClinicsche()));
                sysparamsList.add(customTableRowByClinicsche);
            }
            if (dto.getCustomTableRowSortSetByClinicsche() != null) {
                DictSysparams customTableRowSortSetByClinicsche = new DictSysparams();
                customTableRowSortSetByClinicsche.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE.getKey());
                customTableRowSortSetByClinicsche.setMemo("【自定义列排序设置(临床预约-预约报到界面)】sortField：排序字段(0:预约时间；1:申请时间；2：排队号；3：床号；4：申请单号；5：入院时间；6：检查类别；)，sortOrder：排序方式(asc、desc)");
                customTableRowSortSetByClinicsche.setParamValue(JsonUtil.toJson(dto.getCustomTableRowSortSetByClinicsche()));
                sysparamsList.add(customTableRowSortSetByClinicsche);
            }
            if (dto.getCustomSearchToolByDeptsche() != null) {
                DictSysparams customSearchToolByDeptsche = new DictSysparams();
                customSearchToolByDeptsche.setParamName(ConstantsUtil.ConfigName.CUSTOM_SEARCH_TOOL_BY_DEPTSCHE.getKey());
                customSearchToolByDeptsche.setMemo("【自定义检索栏(临床预约-综合查询界面)】columnName：界面显示名称；mateName：匹配名（固定写死）；");
                customSearchToolByDeptsche.setParamValue(JsonUtil.toJson(dto.getCustomSearchToolByDeptsche()));
                sysparamsList.add(customSearchToolByDeptsche);
            }
            if (dto.getCustomTableRowByDeptsche() != null) {
                DictSysparams customTableRowByDeptsche = new DictSysparams();
                customTableRowByDeptsche.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_BY_DEPTSCHE.getKey());
                customTableRowByDeptsche.setMemo("【自定义表格列(临床预约-综合查询界面)】columnName：界面显示名称；mateName：匹配名（固定写死）；percentage：列宽；");
                customTableRowByDeptsche.setParamValue(JsonUtil.toJson(dto.getCustomTableRowByDeptsche()));
                sysparamsList.add(customTableRowByDeptsche);
            }
            if (dto.getCustomTableRowSortSetByDeptsche() != null) {
                DictSysparams customTableRowSortSetByDeptsche = new DictSysparams();
                customTableRowSortSetByDeptsche.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_DEPTSCHE.getKey());
                customTableRowSortSetByDeptsche.setMemo("【自定义列排序设置(临床预约-综合查询界面)】sortField：排序字段(0:预约时间；1:申请时间；2：排队号；3：床号；4：申请单号；5：入院时间；6：检查类别；)，sortOrder：排序方式(asc、desc)");
                customTableRowSortSetByDeptsche.setParamValue(JsonUtil.toJson(dto.getCustomTableRowSortSetByDeptsche()));
                sysparamsList.add(customTableRowSortSetByDeptsche);
            }
            if (dto.getCustomTableRowSortSetByClinicschePatientList() != null) {
                DictSysparams customTableRowSortSetByClinicschePatientList = new DictSysparams();
                customTableRowSortSetByClinicschePatientList.setParamName(ConstantsUtil.ConfigName.CUSTOM_TABLE_ROW_SORT_SET_BY_CLINICSCHE_PATIENT_LIST.getKey());
                customTableRowSortSetByClinicschePatientList.setMemo("【自定义列排序设置(临床预约-预约报到界面-患者列表)】sortField：排序字段(0:预约时间；1:申请时间；2：排队号；3：床号；4：申请单号；5：入院时间；6：检查类别；)，sortOrder：排序方式(asc、desc)");
                customTableRowSortSetByClinicschePatientList.setParamValue(JsonUtil.toJson(dto.getCustomTableRowSortSetByClinicschePatientList()));
                sysparamsList.add(customTableRowSortSetByClinicschePatientList);
            }
            if (dto.getPrintListByDeptsche() != null) {
                DictSysparams printListByDeptsche = new DictSysparams();
                printListByDeptsche.setParamName(ConstantsUtil.ConfigName.YY_PRINT_LIST_BY_DEPTSCHE.getKey());
                printListByDeptsche.setMemo("【打印清单(临床预约-综合查询界面)】姓名:name,性别:sex,年龄:age,检查项目:itemName,申请时间:reqDate,预约时间:scheduleDate,病人ID:sickId,床号:bedNo,护理单元:nurseUnit,病人来源:patientSource,申请科室:reqDeptName,申请单号:applyNo,申请医生:reqPhysician,电话:phoneNumber,检查类别:examClass,预约队列:queueName,门诊号:outpatientNo,申请病区:reqWardName,优先级别:priorityOrder,运送工具:transTool,是否陪检:accomExam");
                printListByDeptsche.setParamValue(JsonUtil.toJson(dto.getPrintListByDeptsche()));
                sysparamsList.add(printListByDeptsche);
            }
            if (dto.getPrintListSortSetByDeptsche() != null) {
                DictSysparams printListSortSetByDeptsche = new DictSysparams();
                printListSortSetByDeptsche.setParamName(ConstantsUtil.ConfigName.YY_PRINT_LIST_SORT_SET_BY_DEPTSCHE.getKey());
                printListSortSetByDeptsche.setMemo("【打印清单自定义列排序设置(临床预约-综合查询界面)】paperWidth：纸张宽度，sortField：排序字段(0:预约时间 1:申请时间 2:排队号 3:床号)，sortOrder：排序方式(asc、desc)，fontSize：字号，title：清单标题，intOrient：纸张打印方向");
                printListSortSetByDeptsche.setParamValue(JsonUtil.toJson(dto.getPrintListSortSetByDeptsche()));
                sysparamsList.add(printListSortSetByDeptsche);
            }
            if (dto.getCustomExcelByDeptsche() != null) {
                DictSysparams customExcelByDeptsche = new DictSysparams();
                customExcelByDeptsche.setParamName(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_BY_DEPTSCHE.getKey());
                customExcelByDeptsche.setMemo("【导出清单(临床预约-综合查询界面)】");
                customExcelByDeptsche.setParamValue(JsonUtil.toJson(dto.getCustomExcelByDeptsche()));
                sysparamsList.add(customExcelByDeptsche);
            }
            if (dto.getCustomExcelSortSetByDeptsche() != null) {
                DictSysparams customExcelSortSetByDeptsche = new DictSysparams();
                customExcelSortSetByDeptsche.setParamName(ConstantsUtil.ConfigName.YY_CUSTOMEXCEL_SORT_SET_BY_DEPTSCHE.getKey());
                customExcelSortSetByDeptsche.setMemo("【导出清单排序设置(临床预约-综合查询界面)】paperWidth：列宽度，sortField：排序字段(0:申请时间 2:床号)，sortOrder：排序方式(asc、desc)，fontSize：字号，title：清单标题");
                customExcelSortSetByDeptsche.setParamValue(JsonUtil.toJson(dto.getCustomExcelSortSetByDeptsche()));
                sysparamsList.add(customExcelSortSetByDeptsche);
            }*/
            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    /***
     * 自定义模块配置
     * @param dto
     * @return 保存结果
     */
    private JsonResult saveConfig4Custom(DictSysparamsDto dto) {
        if (Objects.nonNull(dto)) {
            List<DictSysparams> sysparamsList = new ArrayList<>();
            if (dto.getCustomConfig() != null) {
                JSONObject jsonObjectData = new JSONObject();
                // 先取出原来的配置
                String paramValue = configService.getConfigByName(ConstantsUtil.ConfigName.CUSTOM_CONFIG.getKey());
                if (StringUtils.isNotBlank(paramValue)) {
                    jsonObjectData = JsonUtil.toJsonObj(paramValue);
                }
                JSONObject jsonObjectParam = JsonUtil.toJsonObj(dto.getCustomConfig());
                // 覆盖或者增加原来的配置
                jsonObjectData.putAll(jsonObjectParam);

                DictSysparams dictSysparams = new DictSysparams();
                dictSysparams.setParamName(ConstantsUtil.ConfigName.CUSTOM_CONFIG.getKey());
                dictSysparams.setMemo("【自定义格式配置】module：模块名；value：配置值；");
                dictSysparams.setParamValue(jsonObjectData.toJSONString());
                sysparamsList.add(dictSysparams);
            }
            // 持久化
            saveSysparmsInfo(sysparamsList);
            return JsonResultUtil.success("保存成功");
        }
        return JsonResultUtil.success("后台接收数据失败");
    }

    private void saveSysparmsInfo(List<DictSysparams> sysparamsList) {
        if (CollectionUtils.isNotEmpty(sysparamsList)) {
            for (DictSysparams sysparams : sysparamsList) {
                QueryWrapper<DictSysparams> queryWrapper = new QueryWrapper<>();
                queryWrapper.eq("PARAM_NAME", sysparams.getParamName());
                queryWrapper.isNull("USER_ID");
                DictSysparams dsResult = baseMapper.selectOne(queryWrapper);
                boolean isExists = false;
                String dataCode;
                String paramValue = sysparams.getParamValue();
                if (dsResult != null) {
                    dataCode = dsResult.getDataCode();
                    if (StringUtils.isBlank(dataCode)) {
                        dataCode = PKGeneratorSingle.getInstance().nextPKStr();
                    }
                    isExists = true;
                } else {
                    dataCode = PKGeneratorSingle.getInstance().nextPKStr();
                }
//                DictSysparamsDataDto sysparamsDataDto = new DictSysparamsDataDto();
//                sysparamsDataDto.setDataCode(dataCode);
//                sysparamsDataDto.setDataValue(paramValue);
//                dictSysparamsDataService.saveOrUpdateSysparamsData(sysparamsDataDto);
                sysparams.setDataCode(dataCode);
                sysparams.setParamValue(StringUtils.isNotBlank(paramValue) ? paramValue : null);
                if (isExists) {
                    baseMapper.updateSysparmsInfo(sysparams);
                } else {
                    baseMapper.insertSysparmsInfo(sysparams);
                }
                cacheServiceImpl.clearConfigCache(sysparams.getParamName());
                // 清空缓存
                EhCacheUtil.removeForCacheName(ConstantsUtil.EhCacheName.scheduleTask.name());
            }
        }
    }

    @Override
    public JsonResult getTransToolList() {
        String tool = configService.getConfigByName(ConstantsUtil.ConfigName.TRANS_TOOL.getKey());
        if (StringUtils.isBlank(tool)) {
            return JsonResultUtil.success("");
        }
        return JsonResultUtil.success("成功", CommonUtil.split2List(tool));
    }

    public JsonResult getCustomSetByUserId(DictSysparamsDto dto) {
        if (StringUtils.isNotBlank(dto.getParamName())) {
            ConfigDto configDto = new ConfigDto();
            DictSysparamsDto dsDto = new DictSysparamsDto();
            dsDto.setParamName(dto.getParamName());
            dsDto.setUserId(dto.getUserId());

            List<DictSysparamsDto> dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
            if (dictSysparamsList == null || dictSysparamsList.isEmpty()) {
                dsDto.setUserId(null);
                dictSysparamsList = baseMapper.selectSysparmsInfoList(dsDto);
            }
            if (dictSysparamsList != null && !dictSysparamsList.isEmpty()) {
                String paramValue = dictSysparamsList.get(0).getDataValue();
                if (StringUtils.isBlank(paramValue)) {
                    paramValue = dictSysparamsList.get(0).getParamValue();
                }
                List<ConfigDto.CustomExcel> list_customParamValue = StringUtils.isNotBlank(paramValue) ? JsonUtil.toList(paramValue, ConfigDto.CustomExcel.class) : new ArrayList<>();
                configDto.setCustomParamValue(list_customParamValue);
            }
            return JsonResultUtil.success("成功", configDto);
        }
        return JsonResultUtil.failure("模块配置名称不能为空");
    }

    public JsonResult saveCustomSetByUserId(DictSysparamsDto dto) {
        if (StringUtils.isNotBlank(dto.getParamName()) && StringUtils.isNotBlank(dto.getUserId())) {
            String paramValue = "";
            String memo = "";
            if (dto.getCustomParamValue() != null) {
                paramValue = JsonUtil.toJson(dto.getCustomParamValue());
                memo = dto.getUserId() + "===>" + ConstantsUtil.ConfigName.getValue(dto.getParamName());
            }
            QueryWrapper<DictSysparams> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("USER_ID", dto.getUserId());
            queryWrapper.eq("PARAM_NAME", dto.getParamName());
            DictSysparams dsResult = baseMapper.selectOne(queryWrapper);

            boolean isExists = false;
            String dataCode = "";
            if (dsResult != null) {
                dataCode = dsResult.getDataCode();
                if (StringUtils.isBlank(dataCode)) {
                    dataCode = PKGeneratorSingle.getInstance().nextPKStr();
                }
                isExists = true;
            } else {
                dataCode = PKGeneratorSingle.getInstance().nextPKStr();
            }
//            DictSysparamsDataDto sysparamsDataDto = new DictSysparamsDataDto();
//            sysparamsDataDto.setDataCode(dataCode);
//            sysparamsDataDto.setDataValue(paramValue);
//            dictSysparamsDataService.saveOrUpdateSysparamsData(sysparamsDataDto);
            DictSysparams sysparams = new DictSysparams();
            sysparams.setUserId(dto.getUserId());
            sysparams.setParamName(dto.getParamName());
            sysparams.setParamValue((StringUtils.isNotBlank(paramValue) && paramValue.length() <= 100) ? paramValue : null);
            sysparams.setMemo(memo);
            sysparams.setDataCode(dataCode);
            if (isExists) {
                baseMapper.updateSysparmsInfo(sysparams);
            } else {
                baseMapper.insertSysparmsInfo(sysparams);
            }
            cacheServiceImpl.clearConfigCache(sysparams.getParamName());
            return JsonResultUtil.success();
        }
        return JsonResultUtil.failure("登录用户ID或模块配置名称不能为空");
    }

    private String configVal(String paramVal, String defaultVal) {
        return StringUtils.isNotBlank(paramVal) ? paramVal : defaultVal;
    }

    private DictSysparams saveConfigInfo(String paramName, String memo, String paramValue) {
        DictSysparams dictSysparams = new DictSysparams();
        dictSysparams.setParamName(paramName);
        dictSysparams.setMemo(memo);
        dictSysparams.setParamValue(paramValue);
        return dictSysparams;
    }
}
